Skip to content

Instantly share code, notes, and snippets.

@AndiSHFR
Created March 20, 2016 14:11
Show Gist options
  • Save AndiSHFR/578ecbd28b7b1d8eab85 to your computer and use it in GitHub Desktop.
Save AndiSHFR/578ecbd28b7b1d8eab85 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