2016-09-26 21:14:03 +00:00
|
|
|
#include "lib/SegmentDisplay.h"
|
|
|
|
|
2016-09-24 12:12:19 +00:00
|
|
|
const int PinBottom = 2;
|
|
|
|
const int PinTop = 5;
|
|
|
|
|
|
|
|
const int PinDigit3 = 3;
|
|
|
|
const int PinDigit2 = 4;
|
|
|
|
|
|
|
|
|
2016-09-26 21:14:03 +00:00
|
|
|
void setup()
|
2016-09-24 12:12:19 +00:00
|
|
|
{
|
|
|
|
pinMode(PinTop, OUTPUT);
|
|
|
|
pinMode(PinBottom, OUTPUT);
|
|
|
|
pinMode(PinDigit3, OUTPUT);
|
|
|
|
pinMode(PinDigit2, OUTPUT);
|
|
|
|
|
|
|
|
digitalWrite(PinTop, LOW);
|
|
|
|
digitalWrite(PinBottom, LOW);
|
|
|
|
}
|
|
|
|
|
|
|
|
int lastTime = 0;
|
|
|
|
bool top = true;
|
|
|
|
|
2016-09-26 21:14:03 +00:00
|
|
|
void loop()
|
2016-09-24 12:12:19 +00:00
|
|
|
{
|
|
|
|
int currentTime = millis();
|
|
|
|
if (currentTime - lastTime > 1000)
|
|
|
|
{
|
|
|
|
top = !top;
|
|
|
|
lastTime = currentTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Digit 3 (right) - switch between top and bottom
|
|
|
|
digitalWrite(PinDigit3, HIGH);
|
|
|
|
|
|
|
|
if (top)
|
|
|
|
{
|
|
|
|
digitalWrite(PinTop, HIGH);
|
|
|
|
delay(1);
|
|
|
|
digitalWrite(PinTop, LOW);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
digitalWrite(PinBottom, HIGH);
|
|
|
|
delay(1);
|
2016-09-26 21:14:03 +00:00
|
|
|
digitalWrite(PinBottom, LOW);
|
2016-09-24 12:12:19 +00:00
|
|
|
}
|
|
|
|
digitalWrite(PinDigit3, LOW);
|
|
|
|
|
|
|
|
|
|
|
|
// Digit 2 (middle) - always bottom
|
|
|
|
digitalWrite(PinDigit2, HIGH);
|
|
|
|
digitalWrite(PinBottom, HIGH);
|
|
|
|
delay(1);
|
2016-09-26 21:14:03 +00:00
|
|
|
digitalWrite(PinBottom, LOW);
|
2016-09-24 12:12:19 +00:00
|
|
|
digitalWrite(PinDigit2, LOW);
|
|
|
|
}
|