You are reading a single comment by @SergeP and its replies. Click here to read the full conversation.
  • My 7 years old daughter have made (with my help) big digital clock. We use 8x32 matrix of ws8212b LED and small ESP8266 board with 5-to-3.3 V LDO on board. LED matrix have separate 2-wire power connector and 3-wire control connector, so we can connect 5V power adaptor to first one and ESP8266 to second one only (using 3 jumper wires - to GND, МСС and GPIO2).

    Then very simple program convert the matrix to digital clock

    var neopixel = require("neopixel");
    E.setTimeZone(3);
    require("Wifi").setSNTP("0.pool.ntp.org"­,0);
    
    require("Font6x8").add(Graphics);
    var g = Graphics.createArrayBuffer(8,32,24,{zigz­ag:true,color_order:'grb'});
    g.setRotation(1,1);
    
    var att=6.9;
    var d=Math.pow(2,att);
    g.setColor(0,0,1/d);
    
    var oldTime, newTime;
    g.setFont6x8();
    
    function drawTime() {
      newTime=Date().toString().substr(16,5);
      if(oldTime != newTime) {
        oldTime=newTime;
        g.clear();
        g.drawString(newTime);
        neopixel.write(D2, g.buffer);
      }
    }
    
    setInterval(drawTime,1000);
    
    neopixel.write(D2, g.buffer);
    

    Some comments:
    Last line are to fix state of LED matrix. It is enough to write first LED (even first logical LED - 1 byte) only but it is harder - we need separate (very small) buffer to do that. So we write all matrix. The line may be removed but first ouput will be incorrect.
    We have found that LED matrix is in fact 8x32 zigzag (first line is right-to-left, second one is left-to-right etc.) So we have added g.setRotation() to use it as 32x8 display.
    I have added att and d vars to control LED brightness more intuitively - now brightness looks to be changed linearly with att change.
    It need a few seconds to get correct time from Internet, so time displayed is strange after power on.

About

Avatar for SergeP @SergeP started