Skip to content

Instantly share code, notes, and snippets.

@rastating
Created January 31, 2014 21:44
Show Gist options
  • Save rastating/8743854 to your computer and use it in GitHub Desktop.
Save rastating/8743854 to your computer and use it in GitHub Desktop.
#include <LEDDisplay.h>
LEDDisplay *led;
int millisecondsPerCount;
int counter;
unsigned long lastUpdate;
void setup()
{
millisecondsPerCount = 1000;
int digitFlagPins[] = {10, 11};
int segmentPins[] = {2, 3, 4, 5 ,6 ,7 ,8, 9};
int decimalPointPin = 9;
led = new LEDDisplay(2, digitFlagPins, segmentPins, decimalPointPin);
}
void loop()
{
unsigned long now = millis();
if (now - lastUpdate > millisecondsPerCount)
{
lastUpdate = now;
counter++;
if (counter == 100)
{
counter = 0;
}
}
int number = counter;
for(int i = 0; i < 2; i++)
{
led->displayNumber(number % 10, i);
delay(2);
number = number / 10;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment