ME170C/ECE181C: Getting Started with Arduino

 


The Arduino board is ‘an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software’.  Because it is open-source, everything you need for your Arduino board can be found, viewed, and downloaded freely on the Arduino website (http://arduino.cc).   To get started, simply follow the instructions here: http://arduino.cc/en/Guide/HomePage.

On the lab computers, you’ll find that the Arduino software and the hardware libraries you will need have already been downloaded to the Arduino folder in Program Files and that a shortcut has been added to your desktop.  Go ahead and open the Arduino software.   From the file menu, you can access examples and set your sketchbook folder, this is where your sketches (code) will be saved.  To try out example code (‘Blink’ under ‘Digital’ is a good one to start with) simply connect your Arduino to the computer via a USB cable and click the ‘upload’ button.  If you have an error it’s probably because the wrong COM port is selected.  Try selecting another port under Tools>Serial Port.  If you successfully upload ‘Blink’, you should see an LED near pin 13 on the Arduino board blinking.

 As you look through the examples and prepare to write your own code, take note of the code structure of the Arduino.  Each program must have a ‘void setup() {}’ and ‘void loop(){}’ section.  The code that is placed in the brackets of the ‘setup’ portion will run once when the Arduino is turned on or reset, whereas the ‘loop’ section will run afterward and continue to repeat.  Variable definitions, comments, etc. can be placed before these in your code.  Reference for the Arduino language syntax and lots of example code can be found on the Arduino website at http://arduino.cc/en/Reference/HomePage.  Don’t forget those semi-colons!