Skip to content

Instantly share code, notes, and snippets.

@mybigman
Forked from AndiSHFR/PulseHeartbeat.c
Created May 3, 2019 13:17
Show Gist options
  • Save mybigman/27a35be57b15827c823feea729def2b2 to your computer and use it in GitHub Desktop.
Save mybigman/27a35be57b15827c823feea729def2b2 to your computer and use it in GitHub Desktop.
/**
* PulseHeartbeat
*
* Blink the onboard LED to signal "Yepp, we are still runnning".
* The onbaord LED is on pin 13 and so pin 13 will be set to OUTPUT.
*
* Call this at the beginning of your loop() function.
* Caution: Will only work if millis() if functional and no one else
* did hook up timer0.
*/
void PulseHeartbeat(void) {
static unsigned long lastMillis = 0;
if(0 == lastMillis) {
pinMode(13, OUTPUT);
}
lastMillis = millis();
digitalWrite(13, ((lastMillis / 1000) % 2 ? HIGH : LOW));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment