Introduction: Tricolor LED ( Streetlight)
Here are the following materials in need:
- Arduino with USB Cable
- Bi or tri-color Led lightbulb
- Jumper wire
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...
Step 1: Connects the Wires
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.
Step 2: Coding
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...