Making Arduino HelloWorld a smidge more interesting
This commit is contained in:
parent
9e8a532da6
commit
aaf02c5155
@ -1,15 +1,27 @@
|
||||
const unsigned int LED_PIN = 13;
|
||||
const unsigned int PAUSE = 500;
|
||||
const unsigned int FLASH_DURATION = 50;
|
||||
|
||||
|
||||
void setup() {
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
digitalWrite(LED_PIN, HIGH);
|
||||
delay(PAUSE);
|
||||
digitalWrite(LED_PIN, LOW);
|
||||
for (int i = 1; i < 4; i++) {
|
||||
flash(i);
|
||||
delay(PAUSE);
|
||||
}
|
||||
delay(PAUSE);
|
||||
}
|
||||
|
||||
|
||||
void flash(int n) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
digitalWrite(LED_PIN, HIGH);
|
||||
delay(FLASH_DURATION);
|
||||
digitalWrite(LED_PIN, LOW);
|
||||
delay(FLASH_DURATION);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user