#include <TM1637.h>
#include <GyverTM1637.h>
byte hrs = 15, mins = 0;
GyverTM1637 disp(2, 3);
TM1637 tm(2, 3); //2-CLK, 3-DIO
uint32_t Now, clocktimer;
boolean flag;
void setup() {
tm.init(); // инициализируем библиотеку
tm.setBrightness(5); // устанавливаем яркость дисплея
disp.clear();
disp.brightness(7);
}
void loop() {
// tm.display("PLAY");
// tm.clearScreen(); // To remove old display artefacts
// tm.switchColon();
// tm.display(9876)->blink(1500);
// tm.display("PLAY-STOP")->scrollLeft(500); // Scroll "PLAY-STOP" to the left each 500 milliseconds
//-----------------------------------------------
runningText();
}
void normClock() {
// byte hrs = 15, mins = 0;
uint32_t tmr;
Now = millis();
while (millis () - Now < 10000) { // каждые 10 секунд
if (millis() - tmr > 500) { // каждые полсекунды
tmr = millis();
flag = !flag;
disp.point(flag); // выкл/выкл точки
// ***** часы! ****
mins ++;
if (mins > 59) {
mins = 0;
hrs++;
if (hrs > 24) hrs = 0;
}
// ***** часы! ****
disp.displayClock(hrs, mins); // выводим время функцией часов
}
}
disp.point(0); // выкл точки
}
void runningText() {
byte welcome_banner[] = {_H, _E, _L, _L, _O, _empty, _empty,
_e, _n, _j, _o, _y, _empty, _empty,
_1, _6, _3, _7, _empty, _d, _i, _S, _P, _l, _a, _y
};
disp.runningString(welcome_banner, 5, 500); // 200 это время в миллисекундах!
}