Commit | Line | Data |
---|---|---|
a3a3e374 H |
1 | /* |
2 | Blink | |
3 | ||
4 | Turns on an LED on for one second, then off for one second, repeatedly. | |
5 | ||
6 | The circuit: | |
7 | * LED connected from digital pin 13 to ground. | |
8 | ||
9 | * Note: On most Arduino boards, there is already an LED on the board | |
10 | connected to pin 13, so you don't need any extra components for this example. | |
11 | ||
12 | ||
13 | Created 1 June 2005 | |
14 | By David Cuartielles | |
15 | ||
16 | http://arduino.cc/en/Tutorial/Blink | |
17 | ||
18 | based on an orginal by H. Barragan for the Wiring i/o board | |
19 | ||
20 | */ | |
21 | ||
22 | int ledPin = 13; // LED connected to digital pin 13 | |
23 | ||
24 | // The setup() method runs once, when the sketch starts | |
25 | ||
26 | void setup() { | |
27 | // initialize the digital pin as an output: | |
28 | pinMode(ledPin, OUTPUT); | |
29 | } | |
30 | ||
31 | // the loop() method runs over and over again, | |
32 | // as long as the Arduino has power | |
33 | ||
34 | void loop() | |
35 | { | |
36 | digitalWrite(ledPin, HIGH); // set the LED on | |
37 | delay(1000); // wait for a second | |
38 | digitalWrite(ledPin, LOW); // set the LED off | |
39 | delay(1000); // wait for a second | |
40 | } |