
© Royalty Free/Corbis
The Interface:

If you need Help with you program...
Hilite a command and then click on Help menu and select Reference:



The Arduino language (based on Wiring) is implemented in C, and therefore has some differences from the Processing language, which is based on Java.
| Arduino | Processing |
| int bar[8]; bar[0] = 1; | int[] bar = new int[8]; bar[0] = 1; |
| int foo[] = { 0, 1, 2 }; | int foo[] = { 0, 1, 2 }; or int[] foo = { 0, 1, 2 }; |
| Arduino | Processing |
| int i; for (i = 0; i < 5; i++) { ... } | for (int i = 0; i < 5; i++) { ... } |
| Arduino | Processing |
| printString("hello world"); printNewline(); | println("hello world"); |
| int i = 5; printInteger(i); printNewline(); | int i = 5; println(i); |
| int i = 5; printString("i = "); printInteger(i); printNewline(); | int i = 5; println("i = " + i); |

An LED is a diode, meaning electrons can flow in
only one direction. In other words, polarity is important. The LED should have a
flat side indicating the cathode or negative terminal.
Also, the anode (positive terminal) generally has a
longer lead than the cathode.
|
/* blink an LED*/
int LED1=8;
void setup(){
pinMode(LED1,OUTPUT);
}
void loop(){
digitalWrite(LED1,HIGH);
delay(500);
digitalWrite(LED1,LOW);
delay(500);
}
| Code | Explanation |
|---|---|
| /* */ | A comment |
| digitalWrite(8,HIGH) | defines the pin to be an output and sets it to a HIGH state, digital 1 or 5V |
| digitalWrite(8,Low) | defines the pin to be an output and sets it to a LOW state, digital 0 or 0V |
| delay(500) | instructs the chip to wait for the defined number of milliseconds (1/1000 seconds). |