Tuesday, March 29, 2011

My first Arduino

w00t! Just wrote my first Arduino program! (If its difficult to tell, take note of the flashing LED)
Published with Blogger-droid v1.6.8

1 comment:

Thegovier_old said...

If anyone's interested the code for the program is:

#define LED 13 // LED connected to
// digital pin 13

void setup ()
{
pinMode(LED, OUTPUT); // sets the digital
// pin as output
}

void loop()
{
digitalWrite(LED, HIGH); // turns the LED on
delay(500); //waits for 0.5 second
digitalWrite(LED, LOW); // turns the LED off
delay(500); // waits for 0.5 second
digitalWrite(LED, HIGH); // turns the LED on
delay(500); //waits for 0.5 second
digitalWrite(LED, LOW); // turns the LED off
delay(500); // waits for 0.5 second
digitalWrite(LED, HIGH); // turns the LED on
delay(500); //waits for 0.5 second
digitalWrite(LED, LOW); // turns the LED off
delay(500); // waits for 0.5 second

digitalWrite(LED, HIGH); // turns the LED on
delay(1500); //waits for 1.5 second
digitalWrite(LED, LOW); // turns the LED off
delay(500); // waits for 0.5 second
digitalWrite(LED, HIGH); // turns the LED on
delay(1500); //waits for 1.5 second
digitalWrite(LED, LOW); // turns the LED off
delay(500); // waits for 0.5 second
digitalWrite(LED, HIGH); // turns the LED on
delay(1500); //waits for 1.5 second
digitalWrite(LED, LOW); // turns the LED off
delay(500); // waits for 0.5 second

digitalWrite(LED, HIGH); // turns the LED on
delay(500); //waits for 0.5 second
digitalWrite(LED, LOW); // turns the LED off
delay(500); // waits for 0.5 second
digitalWrite(LED, HIGH); // turns the LED on
delay(500); //waits for 0.5 second
digitalWrite(LED, LOW); // turns the LED off
delay(500); // waits for 0.5 second
digitalWrite(LED, HIGH); // turns the LED on
delay(500); //waits for 0.5 second
digitalWrite(LED, LOW); // turns the LED off
delay(3000); // waits for 0.5 second

}