Programming an Arduino board
Let's start with the following steps:
Download the Arduino IDE from www.arduino.cc (the current version is 1.0.6).
Unzip and run it.
Go to the File menu and click on New. A new window with an empty sketch (that is, an Arduino program) will be created.
Fill it with the following code:
void setup() { Serial.begin(9600); } void loop() { int analogIn = analogRead(A0); float value = analogIn / 1023.0; Serial.println(value); }
Tip
This code is written in the Arduino language. This language resembles the C, C++, and Java languages. It includes special constants, functions, and objects related to specific hardware capabilities of the Arduino board, such as analog inputs and serial ports.
This code consists of two functions,
setup()
andloop()
. Both functions are required to be defined in any Arduino sketch. Thesetup()
function is called once when the board is started (or restarted). After that, theloop()
function is called repeatedly until the board is powered off...