This class combines a heartbeat live indicator with a handy diagnostics tool. You can show software problems by its own LED blinking code message. The Heartbeat is part of the Albert library which you can download at GitHub here.

Due to saturation of the video camera the heartbeat looks not so good than in reality.

Example program

#include "Albert.h"
const byte LedPin = d[17];//12;
HeartBeat heartBeat(LedPin);
void test_blinkCount()
{ if(millis() > 6000 & millis() < 11000) heartBeat.blinkCount(3); // 3 has preference
  if(millis() > 6000 & millis() < 11000) heartBeat.blinkCount(2); // ignored
  if(millis() > 10000 & millis() < 18000) heartBeat.blinkCount(1); // end with flashing one time, followed by heartBeat
}
void setup(void) 
{ 
}
void loop(void) 
{ heartBeat.poll(); 
  test_blinkCount();
}

Notes

  • If there are multiple warnings, the one with the highest priority will be shown. 
  • The value of the LED series resistor depends on the LED efficiency. It must be selected so that the light varies fluently from minimum to maximum.
  • The SimpleSoftPWM class is used to avoid the use of a hardware timer, which is convenient because the number of timers is limited.
  • You can use all Arduino pins.

 

 

Do you have any comments? Please let me know.
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.