Lighting an LED with a Button
This tutorial is another is our Arduino basics that will get you comfortable with the idea of programming your Arduino, using a breadboard and arranging some simple components. First things first, lets layout our breadboard with the following:
1. Momentary Push Button
2. 1- 330 Ohm Resistor
3. One LED
4. Three jumper wires (red, black and orange).
Arrange the wires and components as seen on the breadboard.
In this case, red will be plugged into pin 13 of the Arduino and it will supply power to the button. When you press the button is will then allow the power to go past, then through the orange wire to the resistor. Remember, the resistor does not care which order it goes in, as long as you make sure its lined up on the breadboard as shown. The power will flow through the resistor to the LED, which will light up while the button is pressed. The black wire completes the circuit returning the power back to ground.
This circuit can use our "Power13" program as nothing fancy is being done by the microcontroller. All the microcontroller will do is supply power through pin 13. Click here to download the sketch.