41 lines
681 B
C++
41 lines
681 B
C++
/*
|
|
Blink BUILTIN LED example
|
|
|
|
Author: Alexander Popov
|
|
License: Unlicense
|
|
*/
|
|
|
|
#include "start.h"
|
|
|
|
/* Blink method:
|
|
true -- delay() used
|
|
false -- millis() used */
|
|
bool blink_method = true;
|
|
bool led_state = HIGH;
|
|
unsigned long timer = 0;
|
|
|
|
void setup() {
|
|
pinMode(LED_BUILTIN, OUTPUT);
|
|
|
|
init_blink(5, 70);
|
|
}
|
|
|
|
void loop() {
|
|
// blink_method = true
|
|
if (blink_method == true) {
|
|
digitalWrite(LED_BUILTIN, HIGH);
|
|
delay(1000);
|
|
digitalWrite(LED_BUILTIN, LOW);
|
|
delay(1000);
|
|
}
|
|
// blink_method = false
|
|
else {
|
|
if (millis() - timer > 200) {
|
|
led_state =! led_state;
|
|
digitalWrite(LED_BUILTIN, led_state);
|
|
|
|
timer = millis();
|
|
}
|
|
}
|
|
}
|