Arduino Workshop @ The Forge

Jeff, Karen & Bob

Digital Read / Serial Out

Image and example from

Notes and explanations

Additional Parts & Symbols

A momentary switch, button, or toggle switch
A 10K resistor

LED Blink Circuit


int is an integer (whole number). In this case, the integer is a global variable - in other words pushButton is substituted for 2 throughout the sketch. Many times it is more convienent to declare variables such as this - it makes it much simpler to change values if needed. Always name your variables descriptively. Variables may be declared in other places as well. In this sketch int buttonState is called in the loop. In this case, buttonState is only available in the loop where it is declared.


Serial.begin(9600) begins the serial stream. Use the speed native to your parts if there is one. Serial speeds used with the arduino are commonly between 9600 and 57600. There are many other Serial commands, see the Serial section in the Arduino reference.


println() is a very useful tool. In this case it will print the serial communication of the button state line by line in the black section near the bottom of the IDE.


digitalRead() reads the state of the button, which is HIGH or LOW.


There are a number of ways to communicate between your Arduino to a computer. Arduino's serial port can communicate over digital pins 0 or 1, or, more commonly over USB. If you are using the USB for serial you cannot use pin 1 or 2 for digital input or output.

Serial monitor

Arduino has a built in serial moniter. At the top right of the IDE is what looks like a magnifying glass icon - click on it to watch serial data across the black section near the bottom.

This project is taken from Arduino's online learning tutorials and is included in the arduino basic examples.