Introduction: Lab 1 - 2 LEDs

This lab creates a circuit with two LEDs, two buttons, and a potentiometer. The two buttons control which LED is turned on, and the potentiometer controls the brightness of the LEDs when they are on.

Step 1: Connect the First LED to the Arduino

The first step is to connect the first LED to the circuit and Arduino.

  1. Place one LED on the breadboard and connect the cathode to the negative rail of the breadboard.
  2. Place a 220Ω resister on the anode leg of the LED and connect the other end to pin 10 on the Arduino.
  3. Connect the negative rail on the breadboard to the grounding pin on the Arduino.

Step 2: Add the Second LED

Add another LED to the circuit the same way as the other LED but connect this one to pin 11 on the Arduino.

Step 3: Add the Potentiometer

This step adds in the potentiometer that we will use to control the LED brightness when the LEDs are turned on.

  1. Add the potentiometer to the breadboard in the middle.
  2. Connect the first pin on the pot to the positive rail on the breadboard.
  3. Connect the last pin to the negative rail on the breadboard.
  4. Connect the middle pin on the potentiometer to the analog input pin labeled A2.

Step 4: Add the First Button

This step will add in the button that will control the first LED.

  1. Connect a momentary push button to the middle of the breadboard.
  2. Connect the bottom-left pin to the positive rail of the breadboard.
  3. Connect the bottom-right pin to pin 3 on the Arduino board.
  4. Connect the top-right pin of the button to a 10KΩ resistor and connect that to the negative rail on the breadboard.

Step 5: Add in the Second Button

Add in another button the same as the last one but connect the bottom-right pin to pin 4 on the Arduino board. Connect the top negative rail to the bottom rail to ground the buttons.

Step 6: Code

Download this code and compile and upload it to your Arduino Uno.