panbachi / wordclock

DIY WordClock
https://www.panbachi.de/eigene-word-clock-bauen/
MIT License
108 stars 47 forks source link

Erweiterungs Wunsch #19

Open maba64 opened 3 years ago

maba64 commented 3 years ago

Hallo

Vielen Dank dass Du deinen Code zur Verfügung stellst !!!

Ich hätte noch zwei Erweiterungswünsche: RTC Modul (DS3231) integrieren (Da ich leider in meinem Hobby Raum kein WIFI habe) ds18b20 Temperatur sensor Besten Dank Markus

WolfgWolf commented 3 years ago

Ich habe den gleichen Wunsch. Es wäre schön den RTC3231 zu integrieren um die NTP Anfragen zu minimieren sowie einen Lichtsensor zur automatischen Helligkeitssteuerung

oe9mdv commented 2 years ago

Ich hätte zwei :-D Ausgabe der IP Adresse und Sekunden Mode (über den Webserver ein und ausschaltbar wenn's geht. Anbei mein Testcode

int Numbers_5x7[10][7] = {

{0x0e, 0x11, 0x13, 0x15, 0x19, 0x11, 0x0e}, // 0x30, 0 {0x04, 0x0c, 0x04, 0x04, 0x04, 0x04, 0x0e}, // 0x31, 1 {0x0e, 0x11, 0x01, 0x02, 0x04, 0x08, 0x1f}, // 0x32, 2 {0x0e, 0x11, 0x01, 0x06, 0x01, 0x11, 0x0e}, // 0x33, 3 {0x02, 0x06, 0x0a, 0x12, 0x1f, 0x02, 0x02}, // 0x34, 4 {0x1f, 0x10, 0x1e, 0x01, 0x01, 0x11, 0x0e}, // 0x35, 5 {0x06, 0x08, 0x10, 0x1e, 0x11, 0x11, 0x0e}, // 0x36, 6 {0x1f, 0x01, 0x02, 0x04, 0x08, 0x08, 0x08}, // 0x37, 7 {0x0e, 0x11, 0x11, 0x0e, 0x11, 0x11, 0x0e}, // 0x38, 8 {0x0e, 0x11, 0x11, 0x0f, 0x01, 0x02, 0x0c} // 0x39, 9 };

int Numbers_3x5[10][5] = { { 0x2, 0x5, 0x5, 0x5, 0x2 }, { 0x2, 0x6, 0x2, 0x2, 0x7 }, { 0x6, 0x1, 0x2, 0x4, 0x7 }, { 0x6, 0x1, 0x2, 0x1, 0x6 }, { 0x1, 0x5, 0x7, 0x1, 0x1 }, { 0x7, 0x4, 0x6, 0x1, 0x6 }, { 0x3, 0x4, 0x6, 0x5, 0x2 }, { 0x7, 0x1, 0x2, 0x2, 0x2 }, { 0x2, 0x5, 0x2, 0x5, 0x2 }, { 0x2, 0x5, 0x3, 0x1, 0x6 } };

int Pos[10][11] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, { 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11}, { 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}, { 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33}, { 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54}, { 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55}, { 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76}, { 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77}, { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98}, {109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99} };

void setNum(int Num, int xPos, int yPos) {

for (int y = 0; y <= 4; y++) { for (int x = 0; x <= 2; x++) { if ((Numbers_3x5[Num][y] & (4 >> x)) == (4 >> x)) leds[Pos[y + yPos][x + xPos]].setRGB(CONFIG.color_fg.r, CONFIG.color_fg.b, CONFIG.color_fg.g); else leds[Pos[y + yPos][x + xPos]].setRGB(0 , 0, 0); } }

}

void Sekunten(int Num, int xPos, int yPos) {

for (int y = 0; y <= 6; y++) { for (int x = 0; x <= 4; x++) { if ((Numbers_5x7[Num][y] & (16 >> x)) == (16 >> x)) leds[Pos[y + yPos][x + xPos]].setRGB(CONFIG.color_fg.r, CONFIG.color_fg.b, CONFIG.color_fg.g); else leds[Pos[y + yPos][x + xPos]].setRGB(0 , 0, 0); } }

} //--------------------------------------------------------------------------------

IPAddress ip; ip = WiFi.localIP();

    int h0 = (int)(ip[0] /100);
    int z0 = (int)((ip[0] %100)/10);
    int e0 = ip[0] - h0*100 - z0*10;

    setNum(h0, 0, 0);
    setNum(z0, 4, 0);
    setNum(e0, 8, 0);

    int h1 = (int)(ip[1] /100);
    int z1 = (int)((ip[1] %100)/10);
    int e1 = ip[1] - h1*100 - z1*10;

    setNum(h1, 0, 5);
    setNum(z1, 4, 5);
    setNum(e1, 8, 5);

    FastLED.show();
    yield();
    FastLED.delay(7);
    delay(10000);
    for (int i = 0; i < NUM_LEDS; i++) {
    leds[i].setRGB(0, 0, 0);}

    int h2 = (int)(ip[2] /100);
    int z2 = (int)((ip[2] %100)/10);
    int e2 = ip[2] - h2*100 - z2*10;

    setNum(h2, 0, 0);
    setNum(z2, 4, 0);
    setNum(e2, 8, 0);

    int h3 = (int)(ip[3] /100);
    int z3 = (int)((ip[3] %100)/10);
    int e3 = ip[3] - h3*100 - z3*10;

    setNum(h3, 0, 5);
    setNum(z3, 4, 5);
    setNum(e3, 8, 5);

    FastLED.show();
    yield();
    FastLED.delay(7);
    delay(10000);

//----------------------------------------------------------------------------------------

void loop() {

timeClient.update();

int h = timeClient.getHours();
int m = timeClient.getMinutes();
int s = timeClient.getSeconds();

if(Show_Sm(true)){

if(h != hour || m != minute || s != seconds) {

    hour = h;
    minute = m;
    seconds = s;

  for (int i = 0; i < NUM_LEDS; i++) {
  leds[i].setRGB(0, 0, 0);}

  int sz = (int)s /10;
  int se = s - sz*10;
  Sekunten(sz, 0, 1);
  Sekunten(se, 6, 1);
  FastLED.show();
  yield();
  FastLED.delay(4);
  }
}
else
{
  if(h != hour || m != minute) {    
    hour = h;
    minute = m;
    show();      
    }

}

server.handleClient();