2016-09-30 21:14:29 +00:00
|
|
|
#include "SegmentDisplay.h"
|
2016-09-24 12:12:19 +00:00
|
|
|
|
2016-09-30 21:14:29 +00:00
|
|
|
SegmentDisplay* display;
|
2016-09-24 12:12:19 +00:00
|
|
|
|
2016-09-26 21:14:03 +00:00
|
|
|
void setup()
|
2016-09-24 12:12:19 +00:00
|
|
|
{
|
2016-09-30 21:14:29 +00:00
|
|
|
display = new SegmentDisplay();
|
|
|
|
//display->setClockSpeed(4000000UL);
|
|
|
|
display->setDigits(2);
|
|
|
|
display->begin();
|
2016-09-24 12:12:19 +00:00
|
|
|
}
|
|
|
|
|
2016-09-30 21:14:29 +00:00
|
|
|
unsigned long lastCounterTime = 0;
|
|
|
|
uint32_t counter = 0;
|
2016-09-24 12:12:19 +00:00
|
|
|
|
2016-09-26 21:14:03 +00:00
|
|
|
void loop()
|
2016-09-24 12:12:19 +00:00
|
|
|
{
|
2016-09-30 21:14:29 +00:00
|
|
|
unsigned long currentTime = millis();
|
2016-09-24 12:12:19 +00:00
|
|
|
|
2016-09-30 21:14:29 +00:00
|
|
|
if (currentTime - lastCounterTime > 1000UL)
|
2016-09-24 12:12:19 +00:00
|
|
|
{
|
2016-09-30 21:14:29 +00:00
|
|
|
counter++;
|
|
|
|
if (counter > 99)
|
|
|
|
counter = 0;
|
2016-09-24 12:12:19 +00:00
|
|
|
|
2016-09-30 21:14:29 +00:00
|
|
|
lastCounterTime = currentTime;
|
|
|
|
}
|
2016-09-24 12:12:19 +00:00
|
|
|
|
2016-09-30 21:14:29 +00:00
|
|
|
display->writeNumber(counter);
|
2016-09-24 12:12:19 +00:00
|
|
|
}
|