Arduino

                                                       2025

R4 Polytech

ΣΥΝΔΕΣΜΟΛΟΓΙΑ LDR

SYNDESMOLOGIA LDR

// Include the Stepper library:
#include <Stepper.h>
// Define number of steps per revolution:
const int stepsPerRevolution = 160;    // Change to your specific stepper motor count per revolution
// Initialize the stepper library on pins 8 through 11:
Stepper myStepper = Stepper(stepsPerRevolution, 8, 9, 10, 11);
#define LDRpinL A0
#define LDRpinR A1
int LDRValueL = 0;
int LDRValueR = 0;
void setup() {
  // Set the motor speed (RPMs):
  myStepper.setSpeed(60); // Change to your specific stepper motor count per revolution
  Serial.begin(9600);
}
void loop() {
  LDRValueL = analogRead(LDRpinL);
  Serial.println(LDRValueL);
  LDRValueR = analogRead(LDRpinR);
  Serial.println(LDRValueR);
if (LDRValueL > LDRValueR) {
      myStepper.step(20);           // put – if opposite direction
      delay(50);
    }
  else if (LDRValueL < LDRValueR) {     // remove – if opposite direction
      myStepper.step(-20);
      delay(50);
    }
  else {
    // we want a case with do nothing
  }}

Solar Tracker

SOLAR TRACKER KAI

// Techatronic.com
#include <Servo.h>      //including the library of servo motor
Servo sg90;
int initial_position = 90;
int LDR1 = A0;          //connect The LDR1 on Pin A0
int LDR2 = A1;          //Connect The LDR2 on pin A1
int error = 5;
int servopin=4;         //You can change servo just makesure its on arduino’s PWM pin
voidsetup()
{
  sg90.attach(servopin);
  pinMode(LDR1, INPUT);
  pinMode(LDR2, INPUT);
  sg90.write(initial_position);   //Move servo at 90 degree
  delay(2000);
}
voidloop()
{
  int R1 = analogRead(LDR1); // read  LDR 1
  int R2 = analogRead(LDR2); // read  LDR 2
  Serial.println(R1);
  Serial.println(“LDR1”);
  Serial.println(R2);
  Serial.println(“LDR1”);
  delay(300);
  int diff1= abs(R1 – R2);
  int diff2= abs(R2 – R1);
  if((diff1 <= error) || (diff2 <= error)) {
  } else {
    if(R1 > R2)
    {
      initial_position = –initial_position;
    }
    if(R1 < R2)
    {
      initial_position = ++initial_position;
    }
  }
  sg90.write(initial_position);
  delay(100);
}

 

 

ΚΑΤΑΣΚΕΥΗ R4

ΚΑΤΑΣΚΕΥ R4

 

Ldr & led ΓΙΩΡΓΟΣ

ΘΕΩΡΙΑ : ΤΑΣΗ ΚΑΙ ΕΝΤΑΣΗ & ΡΕΥΜΑ

CircuitAcs712 0351b8df e162 4b49 b551 8c796f1ff67e

9e88337f7cb76e1de17b0d275bbecf835718283e