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
main.cpp@1:23535cfbf924, 2017-11-02 (annotated)
- Committer:
- charly
- Date:
- Thu Nov 02 20:32:09 2017 +0000
- Revision:
- 1:23535cfbf924
- Parent:
- 0:afb6ebe20c1f
- Child:
- 2:d39f37d64441
Initial Version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
charly | 1:23535cfbf924 | 1 | // Wordclock with WS2812-LED-Stripe |
charly | 1:23535cfbf924 | 2 | // with 11x10 LED-Matrix and 4 minute-LEDS |
morecat_lab | 0:afb6ebe20c1f | 3 | /* |
morecat_lab | 0:afb6ebe20c1f | 4 | |
charly | 1:23535cfbf924 | 5 | ESKISTLFÜNF |
charly | 1:23535cfbf924 | 6 | ZEHNZWANZIG |
charly | 1:23535cfbf924 | 7 | DREIVIERTEL |
charly | 1:23535cfbf924 | 8 | TGNACHVORJM |
charly | 1:23535cfbf924 | 9 | HALBXZWÖLFP |
charly | 1:23535cfbf924 | 10 | ZWEINSIEBEN |
charly | 1:23535cfbf924 | 11 | KDREIRHFÜNF |
charly | 1:23535cfbf924 | 12 | ELFNEUNVIER |
charly | 1:23535cfbf924 | 13 | WACHTZEHNRS |
charly | 1:23535cfbf924 | 14 | BSECHSFMUHR |
charly | 1:23535cfbf924 | 15 | **** |
charly | 1:23535cfbf924 | 16 | */ |
morecat_lab | 0:afb6ebe20c1f | 17 | |
morecat_lab | 0:afb6ebe20c1f | 18 | |
morecat_lab | 0:afb6ebe20c1f | 19 | #include "mbed.h" |
morecat_lab | 0:afb6ebe20c1f | 20 | #include "neopixel.h" |
charly | 1:23535cfbf924 | 21 | #include "WordClock.h" |
morecat_lab | 0:afb6ebe20c1f | 22 | |
morecat_lab | 0:afb6ebe20c1f | 23 | |
charly | 1:23535cfbf924 | 24 | // brigtness beween 0 and 1.0 |
charly | 1:23535cfbf924 | 25 | #define BRIGHTNESS 0.5 |
morecat_lab | 0:afb6ebe20c1f | 26 | |
morecat_lab | 0:afb6ebe20c1f | 27 | |
morecat_lab | 0:afb6ebe20c1f | 28 | int main() { |
charly | 1:23535cfbf924 | 29 | |
charly | 1:23535cfbf924 | 30 | // WordClock object with leds connected to p5 (MOSI) |
charly | 1:23535cfbf924 | 31 | WordClock clock(p5); |
charly | 1:23535cfbf924 | 32 | |
charly | 1:23535cfbf924 | 33 | Timer timer; |
charly | 1:23535cfbf924 | 34 | |
charly | 1:23535cfbf924 | 35 | time_t now; |
charly | 1:23535cfbf924 | 36 | |
charly | 1:23535cfbf924 | 37 | { |
charly | 1:23535cfbf924 | 38 | |
charly | 1:23535cfbf924 | 39 | timer.start(); |
morecat_lab | 0:afb6ebe20c1f | 40 | |
charly | 1:23535cfbf924 | 41 | while(1) |
charly | 1:23535cfbf924 | 42 | { |
charly | 1:23535cfbf924 | 43 | // Update the colors array. |
charly | 1:23535cfbf924 | 44 | uint32_t time = timer.read_ms(); |
charly | 1:23535cfbf924 | 45 | for(int i = 0; i < NUMLEDS; i++) |
charly | 1:23535cfbf924 | 46 | { |
charly | 1:23535cfbf924 | 47 | uint8_t phase = (time >> 4) - (i << 2); |
charly | 1:23535cfbf924 | 48 | //ledstripe[i] = hsvToRgb(phase / 256.0, 1.0, BRIGHTNESS); |
charly | 1:23535cfbf924 | 49 | } |
charly | 1:23535cfbf924 | 50 | clock.display_time(now); |
morecat_lab | 0:afb6ebe20c1f | 51 | } |
morecat_lab | 0:afb6ebe20c1f | 52 | } |
charly | 1:23535cfbf924 | 53 | |
charly | 1:23535cfbf924 | 54 | } |