Charging Reminder
It is for reminding you to charge your computer or your phone, so when you put your phone on the reminder, and the LED will turn off, and if you forget to put your phone on it, the light will stays on.
(when I charge my phone, I will put it in the same place, so I can remember to charge my phone)
Prepare Your Material
Arduino Leonardo *1
Breadboard *1
Wire *7
Long Wire (one side) *4
Photoresistance *1
Resistance *2 (1 Blue and 1 Yellow)
LED *1 (any color)
USB line *1
Circuit Diagram
Code
https://create.arduino.cc/editor/arielhuang1206/e9...
void setup(){ // put your setup code here, to run once:
pinMode( 10 , OUTPUT); // sets the digital pin as output }
void loop(){ // put your main code here, to run repeatedly:
if ( analogRead( A0 ) < 550 ) { digitalWrite( 10 , LOW ); // sets the digital pin on/off }
if ( analogRead( A0 ) > 650 ) { digitalWrite( 10 , HIGH ); // sets the digital pin on/off }
}
Outlook
Use a box to put your Arduino inside, and let the Photoresistance and the LED light stays on the outside of the box.