Tricolor LED ( Streetlight)

by cc_chao in Circuits > Arduino

269 Views, 0 Favorites, 0 Comments

Tricolor LED ( Streetlight)

IMG_1592.JPG
IMG_1593.JPG
IMG_1594.JPG
IMG_1595.JPG
IMG_1610.PNG
Arduino streetlight

Here are the following materials in need:

- Arduino with USB Cable

- Bi or tri-color Led lightbulb

- Jumper wire

- Breadboard

The LED light (who has four legs) above is a tri-colored lightbulb, which means the lightbulb has the capacity of demonstrating three colors in a row. The pin in the middle is a negatively charged pin, while the two on the sides are positive (we'll only be using three pins in this case, so you can fold one of your pins on the side, up). I've changed a few things, such as the order of the lights, and the decorations. Moreover, the LED light will change its light automatically, it ranges from the color red, green, and yellow.

Lesson adapted from https://www.instructables.com/id/A-Beginner-Arduin...

Connects the Wires

IMG_1596.JPG
IMG_1597.JPG
IMG_1598.JPG
IMG_1599.JPG
Screen Shot 2020-04-14 at 3.33.32 PM.png

As mentioned before, the middle pin is negative, so you have to attach the middle pin with GND. The two pins on the side are positive, therefore, it has to be connected to the digital pins on the breadboard. However, do not attach the two pins on the side with the last two digital pins, since the last two digital pins are negatively charged. Attach one of the pins to the 10th digital pin, and another to 9. Lastly, attach your USB to open Arduino on your device.

Coding

IMG_1610.PNG
IMG_1610.PNG
Screen Shot 2020-04-16 at 11.32.19 AM.png

At the top, int stands for integer, which is the digital pins we connected to the side pins on the previous step. We need to repeat typing int for pin 10 as well. However, GND does not need to be mentioned. In loop, means te process will be repeated for infinity times. DigitalWrite stands for ON and OFF the lightbulb. Delay means the times we are going to put LED on and off. The sequence of colors is red, green and yellow. This lesson is adapted from: https://www.instructables.com/id/A-Beginner-Arduin... Please check out their website for further understanding.

website for the code: https://create.arduino.cc/editor/coco_chao/34e0727...