Sketches

Unlike many development systems, the Arduino IDE doesn't have a debugging tool that allows you to step through a program and inspect the values of variables as they change.

This fact implies that developing for Arduino requires special care to systematically test parts of the system. We test each step as we go along.

The first step is to build the circuit and connect the laptop to the Arduino using the USB cable. Once that is done, open the Arduino IDE application on the desktop. You may need to use the Serial Port and Board menu items in Tools menu of the IDE to configure and connect your Arduino.

Locate and open the Sketch in the File menu. Use Upload from the File menu to run it. Once it is uploaded, use the Serial Monitor item in the Tools menu to interact with the Sketch.

The first sketch is to become familiar with how to program for the serial port. (USB cable).

The next sketch is to check out the LEDs. Entering a LED number into the SerialMonitor, causes the corresponding LED to glow (if everything is working).

There are two ways to use the output pins: a pin at a time or through ports.

Another sketch is used to check out and calibrate the sensor input.

In the final sketch, everything comes together. The value from the sensor is displayed on the LEDs. The laptop is not needed for this sketch to run.

Download the sketches