24 lines
630 B
C++
24 lines
630 B
C++
|
#include "effect_analogclock.h"
|
||
|
#include "my_fastled.h"
|
||
|
#include "ntp.h"
|
||
|
|
||
|
void AnalogClockEffect::loop() {
|
||
|
window->clear();
|
||
|
CRGB white(0xFFFFFF);
|
||
|
CRGB red(0xFF0000);
|
||
|
window->circle(8, 8, 7, &white);
|
||
|
|
||
|
uint8_t seconds = ntpClient.getSeconds();
|
||
|
uint8_t angle = 6 * seconds;
|
||
|
window->lineWithAngle(8, 8, angle, 0, 10, &red);
|
||
|
/*for (uint8_t i=0; i<=12; i++) {
|
||
|
window->lineWithAngle(8, 8, 255/12*i, 5, 2, &white);
|
||
|
}
|
||
|
|
||
|
uint8_t minutes = ntpClient.getMinutes();
|
||
|
uint8_t hours = ntpClient.getHours();
|
||
|
|
||
|
window->lineWithAngle(8, 8, 255/60*minutes, 6, &white);
|
||
|
window->lineWithAngle(8, 8, 255/12*(hours % 12), 4, &white);*/
|
||
|
}
|