Video
Hello, guys, my name is Krish Singh Chandhok and I am 11 years old Today I am making a sunglass robot it's working when you are in sun and gets of when you are in shadow.lets see how to make it
Step 1:connect servo motor and LDR
Solder the all the components on the board with the help of the diagram.
Step 2: remove the glasses.
Remove the glasses from the sunglass.
Step 3: stick the glass on the servo horn like this.

Now stick the servo motor on the frame.
Step 4: stick Arduino Uno and LDR sensor on the frame like this .

Like this.
Step 5: Upload the code.
#include<Servo.h>
Servo sglass; //servo name
int ldr= 0; //connect LDR to A0
int value= 0; //define value 0
void setup()
{
Serial.begin(9600); //this is not necessary-but to show value to pc
sglass.attach(9); //declare in which pin the servo you attach
}
void loop()
{
value = analogRead(ldr); //read value-analog from A0
Serial.println(value);
delay(100);
if(value<100) //change the value as you wish
{
sglass.write(155); //black glass down
delay(100); //a bit delay for the servo to move there
}
else
{
sglass.write(80); //black glass up
delay(100);
}
}
Step 6 : ready to work.
Power on the project wear the glasses and it's ready to work.
Demo : here's the demo you can watch