31 lines
486 B
C++
31 lines
486 B
C++
#include "SegmentDisplay.h"
|
|
|
|
SegmentDisplay* display;
|
|
|
|
void setup()
|
|
{
|
|
display = new SegmentDisplay();
|
|
//display->setClockSpeed(4000000UL);
|
|
display->setDigits(2);
|
|
display->begin();
|
|
}
|
|
|
|
unsigned long lastCounterTime = 0;
|
|
uint32_t counter = 0;
|
|
|
|
void loop()
|
|
{
|
|
unsigned long currentTime = millis();
|
|
|
|
if (currentTime - lastCounterTime > 1000UL)
|
|
{
|
|
counter++;
|
|
if (counter > 99)
|
|
counter = 0;
|
|
|
|
lastCounterTime = currentTime;
|
|
}
|
|
|
|
display->writeNumber(counter);
|
|
}
|