Introduction
In this lesson, we will learn about how to create a notification system using an RGB LED and a pushbutton. To make the project you need:
- Unda Xplora Kit
- RGB LED
- 3 220ohm resistors
- 1 Pushbutton (pick any color of your choice)
- Jumper wires and Breadboarding jumper wires
Let’s build the Notification Lights Project
Let’s build:
Place the RGB LED and three 220 ohm resistors on the breadboard. Recall that the longest lead is the negative pin thus it is not connected to a resistor.
Using a breadboarding jumper wire, connect between the resistor R3 and the fourth pin of the RGB LED. Connect between resistor R1 and the first pin of the RGB LED using a breadboarding jumper wire. The third pin of the RGB LED is connected directly to the resistor.
Connect jumper wires from digital pin D2 to one side of Resistor 1, from digital pin D4 to one side of Resistor 2 and from digital pin D6 to one side of Resistor 3.
Place one pushbutton and one 10kiloohm resistor on the breadboard.
Connect a jumper wire from digital pin D10 to one side of the 10kiloohm resistor as shown below. Connect another jumper wire from 5v to the other pin of the pushbutton.
Connect a jumper wire from GND to the top breadboard negative rail. Using breadboarding jumper wires connect from breadboard negative rail to the negative pin of the RGB LED. Connect using a jumper wire from breadboard negative rail to the other side of the 10kiloohm resistor.
Return to the main project window and run the project. Now press the pushbutton and observe what happens. Press it again and observe what happens.
What did you observe?
When we run our project, we observe that the tri-color LED initially lights red. When the button is pressed, the LED turns green. Pressing the button again changes the LED’s color to red.
But why is this so?
Just like a TV that is connected to power but is not switched on, the LED lights red. Pressing the button, like pressing a remote to turn on the TV, sends a signal to our minicomputer that tells it to send a signal 1 to the LED that changes its color to green.
When we press the switch, the metal contacts close and a current passes. When the current is received by our minicomputer, a signal is sent to the LED to change its state and color just like in our TVs.
Feedback is closed.