05c: Running a Program

Objective: To run a program on an Arduino.

The best references for getting started with the Arduino are supplied with the IDE: the Help menu includes a section for Getting Started which covers operation and Reference which covers the language.

In addition, the main Arduino site has similar introduction pages:

  1. Arduino: Getting Started
  2. Arduino: Reference

The Arduino Tutorial Foundations page addresses many basic ideas and syntax. If you are still a relative novice programmer, please be sure to look at First Sketch, Variables, and Functions.

Program 1: Blink.

  1. Connect an Arduino Uno to the host computer with the IDE.
  2. Configure the IDE for the Uno as per the Getting Started guide.
  3. Load the Examples/01.Basics/Blink sketch. The Examples are found in the File menu, as is the Sketchbook in which you can put your own programs. Your Sketchbook (just like in Processing) is stored in your Documents directory.
  4. This program uses just the LED onboard the Uno, so no additional external circuit is required.
  5. Verify/Compile the program to check that the program text is valid.
  6. Upload to the Uno and check that the LED blinks when the program runs.
  7. Change the numbers in the delay statements; the units are milliseconds.
  8. Re-upload and observe the change in LED behavior.

Program 2: ReadAnalogVoltage.

  1. Upload the ReadAnalogVoltage sketch.
  2. Find and open the Serial Monitor. Set it to 9600 baud to match the sketch.
  3. Observe the measurements of analog noise printed to the monitor. Attach a wire to A0 and touch it with your finger to change the noise input.
  4. The serial monitor is your primary means for seeing the debugging output from your programs; you should become familiar with the Serial library and printing out text and numbers. Yes: It can be difficult to debug complex programs when the serial port is the only source of information.