Introduction: Lab 1 Adventures in Computing

In this demonstration we will show how to control which of two LEDs is active by pressing two different buttons.

1.) To begin, you must have an arduino uno kit.

2.) Remove the arduino (left) and breadboard (right) from the kit.

Step 1: Begin Adding Components

At this point you should have your arduino and breadboard out.

1.) Add an LED of any color to your board.

2.) Connect a copper wire to the ground of the arduino (denoted by GND) and attach it to the ground portion of your breadboard (denoted by -).

3.) Connect a copper wire from your ground rail to the rail containing the short connector of the LED.

4.) Connect one end of a 220 ohms resistor to pin 10 of the arduino board.

5.) Connect the other end of the resistor to the other rail that the LED is in.

Step 2: Add Another Led

Similarly to before, another LED will be added.

1.) Add a different color LED using the same steps as before, while placing it into pin 9 instead of 10.

Step 3: Add a Button Component

At this point two LEDs should be connected.

1.) Attach a button to your breadboard.

2.) Attach a copper wire running from the 5V pin on the arduino to the rail denoted by +.

3.) Attach a copper wire running from the power rail to the button itself.

4.) Attach a 10K Ohm resistor from the button to the ground rail.

5.) Attach a copper wire running from the backside of the button to pin 5 on the digital side of the arduino board.

Step 4: Add Another Button

With two LEDS and a button already in place, it is time to add another button.

1.) Using the same steps as before, another button should be placed on the breadboard. As with the other button, when this is pressed current will be allowed to flow and a specific light will turn on.

2.) The only difference in this instance is a copper wire will be attached into pin 4 instead of pin 5.

Step 5: Testing Your Project

As this is the final step and everything should function properly, source code is provided below. When the top button is pressed, the upper light should receive power and turn on. When the bottom button is pressed, it should turn on as well.

Attachments