// Servo Sweep example for the ESP32
// https://wokwi.com/arduino/projects/323706614646309460
#include <ESP32Servo.h>
Servo arm;
float pos = 0.0;
float step = 1.0;
void setup()
{
Serial.begin(115200);
pinMode(25, INPUT_PULLUP);
pinMode(26, INPUT_PULLUP);
arm.attach(18);
arm.write(pos);
}
void loop()
{
if (!digitalRead(25))
{
if (pos>0)
{
arm.write(pos);
pos-=step;
delay(1000);
}
}
const float BETA = 3950;
const int analoglnPin = 34;
int analogValue = 0;
int ldrStatus = digitalRead(26);
if(ldrStatus==HIGH)
{
digitalWrite(18, HIGH);
Serial.println("LDR-->DARK, LED-->ON");
}
else
{
digitalWrite(18, LOW);
Serial.println("LDR-->BRIGHT, LED-->OFF");
}
delay(1000);
}