Introduction: Button With Dimmer Tutorial
This will be an Arduino tutorial on how to turn 2 LEDs on and off and also how to dim the LEDs when they are on using a potentiometer.
At the end of this tutorial, your button should turn both LEDs on and off. Then, your potentiometer will adjust the brightness of the bulbs.
Step 1: Attach an LED to Your Board
1. Insert LED into slots E4 and E5 on your breadboard. E4 should be the anode (the longer side), and E5 (the shorter side) should be the cathode.
2. Connect a 220 Ohm resistor to D4 on your breadboard and to pin 11 on your Arduino board.
3. Connect a wire from D5 to the ground bar on the side of your breadboard.
4. Connect a wire from anywhere on the ground column into the ground pin on your Arduino.
Step 2: Add a Button to Turn the LED on and Off
1. Attach a button into slots E10, E12, F10, and F12.
2. Attach a wire from D10 to the power column on your breadboard.
3. Connect a wire from anywhere on the power column to the 5v pin on your Arduino
4. Connect a resistor from D12 to the ground column on your Breadboard
5. Connect a wire from G12 to pin 12 on your Arduino
Step 3: Add a Second LED
1. Attach a second LED with the anode (longer side) in E2 of your breadboard and the cathode (shorter side) going into E3 on you breadboard.
2. Connect a 220 Ohm resistor from D2 on the breadboard into pin 10 on your Arduino
3. Attach a wire from D3 on the breadboard to the ground column
4. Write code to set what pin the led is plugged into.
Step 4: Add Potentiometer to Control Brightness
1. Attach potentiometer to breadboard. Attach to slots E20, E22, and H21.
2. The diagram shows the middle pin being on the same side as the outer pins, but with our potentiometers, the middle pin is on the opposite side. To avoid confusion, follow these written instructions for which slots to place things into
3. Attach a wire from A20 on the breadboard to the power column on your breadboard.
4. Attach another wire from A22 on the breadboard to the ground column on the breadboard
5. Attach a wire from I21 on the breadboard to A2 on the Arduino.
6. In your code, you have to tell the arduino what speed to transmit serial at.
7. Then, in the setup method, you can set the pin mode for the potentiometer.
5 years ago
Very nicely done! Great introductory instructable!