Digital Pins and digitalWrite()

Any of the pins on the Arduino Uno, 0 through 14 can be used as output. The analog input pins, A0 through A6 can also be used as digital output. In this project, output pins 8 through 13 are used to drive the six LEDs.

In the setup() function, the pin must be identified as an output pin with pinMode().

To set the output pin to HIGH or LOW, use digitalWrite(). This technique of changing output pins one at a time is the most common way that sketches control devices.

This sketch is used to verify that the LEDs are correctly wired and working.

Using the sketch

Use the Serial Monitor in the Arduino IDE to control the LEDs. Enter a value 0 to 5. The corresponding LED will toggle.