WordClock-Program to display time in words on WS2812B-LED-Stripe. With DS3231 RTC
Dependencies: PixelArray WordClock_de ds3231 mbed
Fork of mbed_ws2812b by
WordClock
Yet another wordclock...
Program for displaying time in (german) words on WS2812B LED-Matrix. Uses DS3231 RTC .
More fotos see:
https://photos.app.goo.gl/mSN6G145IdupbKv13
Diff: main.cpp
- Revision:
- 2:d39f37d64441
- Parent:
- 1:23535cfbf924
- Child:
- 3:ebe0c4fa97b8
--- a/main.cpp Thu Nov 02 20:32:09 2017 +0000 +++ b/main.cpp Sun Nov 05 10:27:14 2017 +0000 @@ -12,7 +12,7 @@ ELFNEUNVIER WACHTZEHNRS BSECHSFMUHR - **** + **** */ @@ -21,34 +21,42 @@ #include "WordClock.h" -// brigtness beween 0 and 1.0 +// brigtness beween 0 and 1.0 #define BRIGHTNESS 0.5 -int main() { +int main() +{ // WordClock object with leds connected to p5 (MOSI) - WordClock clock(p5); + WordClock clock(p5); Timer timer; - + time_t now; -{ - - timer.start(); - - while(1) { - // Update the colors array. - uint32_t time = timer.read_ms(); - for(int i = 0; i < NUMLEDS; i++) - { - uint8_t phase = (time >> 4) - (i << 2); - //ledstripe[i] = hsvToRgb(phase / 256.0, 1.0, BRIGHTNESS); + + timer.start(); + + while(1) { + // all words + for (int i=1; i<=NUMWORDS;i++) { + clock.test_display(3,i); + wait_ms(800); + } + //all leds on with rainbow colors + while ( int(timer.read()/10.0) %2 == 0) { + clock.test_display(1); + wait_ms(100); + } + // every led on for 250ms + for (int i=0; i<NUMLEDS;i++) { + clock.test_display(2,i); + wait_ms(250); + } + timer.reset(); } - clock.display_time(now); } + } - -}