Arduino first steps
Revision as of 13:48, 24 November 2014 by Alexanderg
If you have never worked with Arduino before, this page describes how to start with your Arduino that you can purchase via the shop .
All you need to 'upload' the example code to your Arduino is:
- One Arduino Nano (or Arduino Mega2560)
- One USB cable
1. Attach the Arduino to your computer
Using an USB cable, attach the Arduino (Arduino Nano or Arduino Mega) to your computer as shown below.
Click here to download the Arduino development software (v1.5.8) to your computer (Windows users should download the 'Installer' version on that page):
After the download completed, install the Arduino development software on your computer: For Windows users, double click the downloaded file ('arduino-1.5.8-windows.exe') in your Windows file explorer to run the installation.
After the installation completed, run the Arduino development software on your computer by double clicking the 'Arduino' symbol on your Windows desktop.
After the Arduino development software has started, choose the menu, and click on 'File->Examples->Basics->Blink'. This will load the Arduino blink example.
6. Choose correct board type
Via the menu, click on 'Tools->Board->Arduino Nano' to choose your Nano board (or Arduino Mega 2560 if you want to use a Mega board).
7. Choose correct USB serial port
Via the menu, click on 'Tools->Port', and choose the detected USB serial port.
Click on the 'Upload' symbol to upload the blink example to your Arduino. After the upload completed, your Arduino will start to blink!
After the code is uploaded, your Arduino will start to blink:
You have just programmed your first Arduino!
Now let's look a little bit closer at the blink code to understand it: The Arduino has several pins, each of them has a number, and each of them can be configured as either INPUT or OUTPUT<b> depending on wheter you want to read it or write to it:
<b>INPUT means that you can read (or measure) that pin. The measurement can be either ON (there is voltage on that pin) or OFF (there is no voltage on that pin). OUTPUT means that you can write (or control) that pin.
We are using the LED pin (pin 13) in the blink example that is already connected to an LED. Because we want to control that pin, we are configuring it as OUTPUT. pinMode(13, OUTPUT);
Now let's see how we can turn ON and OFF the LED using an Arduino command. This command will turn ON the voltage for pin 13:
And this command will turn OFF the voltage for pin 13:
digitalWrite(13, LOW); Let's see how we can wait one second between the ON and OFF toggling. This command will wait (halt) the program for one second:
Now you can try to upload the Ardumower code the same way as you uploaded the blink example!