Circuit With Potentiometer and 3 LEDs
by tejbho305 in Circuits > Arduino
22 Views, 0 Favorites, 0 Comments
Circuit With Potentiometer and 3 LEDs
This circuit uses a potentiometer and 3 LEDs of different colors: green, yellow, and red. Turning the knob of the potentiometer will change what light turns on.
Supplies
- Elegoo Uno R3 microcontroller board
- Breadboard
- USB cable
- laptop
- 1 Potentiometer
- 1 Green LED
- 1 Yellow LED
- 1 Red LED
- 3 330 ohm resistors
Connect the Potentiometer
Start by placing a wire going from the "-" row of the the breadboard the ground pin on the circuit board. Then connect the right of the potentiometer to ground. Connect the left side of the potentiometer to 5V. Finally, connect the bottom of the potentiometer to the A2 pin.
Connect the Red LED
Connect one wire from pin 9 to the breadboard. Connect this to one resistor and the red LED. Then place one wire from the LED to the ground line.
Connect the Yellow LED
Do the same thing to the yellow LED as you did for the red LED, but this time using pin 5.
Connect the Green LED
Repeat the same process for the green LED, using pin 2. Once you're done, use the USB cable to attach the microcontroller board to the laptop.
Install Arduino IDE
Install Arduino IDE for your computer.
https://www.arduino.cc/en/software
Write the Program
Download the file below, or go to https://github.com/tejbho/ArduinoProjects/blob/main/3LightPotentiometer/3LightPotentiometer.ino
Downloads
Test the Circuit
Turn the knob on the potentiometer. The Serial Monitor should write the value of the potentiometer continuously. The red LED should turn on when the value is less than 3. The yellow LED will turn on if the value is between 3 and 4. The green LED will turn on if the value is greater than 4. Download the video below to see how it works.