Button exercise |
/*
Count to 5.
This code counts from one flash of an LED up to 5 flashes, and then loops.
ELEGANT
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
void loop() {
int i = 1; //counter variable
int j = 1; //counter variable
for(i=1; i<6; ++i){
for(j=1; j<=i; ++j){
digitalWrite(led, HIGH); // 1 Flash
delay(200);
digitalWrite(led, LOW);
delay(400);
}
delay(1000);
}
}
No comments:
Post a Comment