Print
Category: Hardware hacking
Hits: 4944

An LED "flasher" to expose unsigned int values via single LED, in cases where Serial is unavailable (e.g. on ATtiny parts, or in field-installed modules). This code is used in the Custom Arduino-based LVD

Uses TinyStack for an internal data structure.

The flasher demo (included in the attached library .zip) in action:

To use this, download Flasher (attached) and TinyStack, unzip & install in your Arduino "libraries" folder, and restart the IDE.

Demo code

#include 
#include 

Flasher flasher = Flasher(13);

void setup() {
  Serial.begin(9600);
}

void loop() {
  flasher.run();
  
  if (! flasher.isFlashing()) {
    int r = random(999);
    Serial.print("flashing ");
    Serial.println(r);
    flasher.start(r);
  }
  delay(20);
}