GY-63_MS5611/libraries/HT16K33/examples/demo_displayTime/demo_displayTime.ino
2021-12-19 15:24:23 +01:00

47 lines
770 B
C++

//
// FILE: demo_displayTime.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// URL: http://www.adafruit.com/products/1002
// URL: https://github.com/RobTillaart/HT16K33
// sketch will work correctly up to 99:99
#include "HT16K33.h"
HT16K33 seg(0x70);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
seg.begin();
Wire.setClock(100000);
seg.displayOn();
seg.setDigits(4);
}
void loop()
{
static uint32_t last = 0;
uint32_t now = millis();
if (now != last)
{
last = now;
uint32_t s = now / 1000;
uint32_t t = (now - s * 1000) / 10;
s = s % 100;
// seg.displayTime(s, t);
seg.displayTime(s, t, true, false); // do not display leading zero.
seg.displayColon(1);
}
}
// -- END OF FILE --