Arduino Light on and Off

by hsuaitingg in Circuits > Arduino

486 Views, 1 Favorites, 0 Comments

Arduino Light on and Off

Screen Shot 2021-04-18 at 23.53.46.png

My design was inspired by https://www.instructables.com/Arduino-LED-Night-L... This Arduino project can add a night light to your room, and you can switch modes at any time. There are two modes in total. The first mode is night light mode, and the second mode is normal lighting. During the switching process, there are two buttons. If you want the night light to turn bright yellow, just press the start button once. In this case, you can press the second button to turn off the machine. If all functions are needed, press the start button twice until the LED turns blue. During each switching process, the buzzer will play a sound to let you know that the machine is starting the switching mode.

Prepare Materials That Are Need.

Screen Shot 2021-04-18 at 23.51.03.png

- Arduino Leonardo Board*1

- Breadboard*1

- LED Lights ( Blue and yellow ) each*1

- Button*2

- 1K Ω resistor (blue) *2

- male to male wires *8

- Arduino 0.5W speaker *1 (with female wires connected)

- 100 ohm resistor (the color of three strikes in the middle-brown black brown) *2

- alligator clip to male wires *4
- pin header *6 For connecting Arduino:

- Laptop

- microUSB to USB cable *1 - USB to type c dongle *1 (if needed)

- Shoe box for covering the breadboard and your Arduino

Staring Setting Up Your Board With the Following Photo Below:

Screen Shot 2021-04-18 at 23.30.20.png

Upload Your Code to Your Arduino Leonardo

Screen Shot 2021-04-19 at 19.45.31.png
Screen Shot 2021-04-19 at 19.45.41.png

Put Your Arduino in a Shoe Box

Screen Shot 2021-04-18 at 23.47.53.png

Dig Hole on Your Shoe Box to See Arduino Inside

You Are Done With This !!!!

View What I've Changed

I changed tone and delay of the LED to faster, changed the for ++i to i++ and Serial begin 9600 to 8400.