This introductory Ardiuno lab demonstrates the concepts of basic digital input and output. A pushbutton is wired from the breadboard to digital input 2 on the Arduino and a red and green LED wired to digital outputs 3 and 4, respectively. A pushbutton is basically two pieces of metal separated by a spring. When depressed, the two pieces of metal touch and the pushbutton sensor is programmed to switch on the red LED. When the pushbutton is not depressed, or when the two pieces of metal are open, the green LED lighted.
My first attempt to upload and run the Arduino was unsuccessful for several reasons.
1. Wrong resistors. Resistors are color-coded to indicate their respective levels of resistance. A 220-ohm resistor was incorrectly used for the switch, where a 10-kilohm resistor should have been placed.
2. Reversed LED connections. The longer leads of the LEDs were incorrectly connected to ground and the shorter lead to 5V.
3. Wrong positive/negative wire connections caused an incorrect circuit.
Also, a second-year student provided a helpful tip in regards to the color coding of wires. In the picture below, the wires create a colorful mess of the breadboard, making it difficult to understand the circuit at a quick glance. As a general rule of thumb, red wires should be used to indicate positive and black wires ground. This is good practice moving forward as circuits get increasingly complex.
With the problems fixed, the Arduino is once again uploaded and this time, with success! Look what I have created! I have made lights blink! (Lines borrowed/altered accordingly from the epic scene in Castaway when Tom Hanks succeeds in making fire.) My final setup below, with wires color-coordinated and trimmed down to shorter lengths.
Tags: Arduino, blinking lights, lab, LED

