The "Hello World!" code for Arduino : blinking a LED. You can see the electronic part in the link above.
//the pin on which you connect the anode (+) of the LED byte ledPin = 13; //our on/off switch byte state = LOW; //this function runs only once (after reset) void setup(){ //set the pin we use to OUTPUT so we can power-up the LED pinMode(ledPin, OUTPUT); } //this function runs continuosly (after setup) void loop(){ //toggle our switch (if off make it on and vice-versa) if (state == LOW){ state = HIGH; } else { state = LOW; } //toggle the LED based on our switch above digitalWrite(ledPin, state); //sleep for 1000 ms = 1 second delay(1000); }
A picture of the electronic part :