• ERROR fix of core line in code fragments in post #6:

    Polarity ('color') is set by either bit 3 or 7, which have the values 8 and 120, respective (and not 64 and 128, which would be bits 6 and 7), in order meet the spec (paraphrased):

    Data byte has to be xxxCyyyc where xxx is the binary representation of
    the x and y coordiantes). c is the color, w/ C is the inverted of c to drive
    the bridge +to- or -to+; for example, x = 2, y = 3, c = 1 would be 010 0 011 1
    (and reversed when using SPI.write() for the shift-out...).

       ...
       SPI1.write( (E.reverseByte(y | (x<<4))>>1) | ((!p) ? 128 : 8), nssPin);
       ...
    

    Recap of wiring:

    Espruino (Pico - 5V tolerant, since flip-dot is 5V driven) to http://www.hannio.org flip-dot-disaplay module (using SPI):

    • GND - GND
    • MOSI - SDA
    • SCK - SCL
    • nssPin - LAT (any pin works)

    FlipDotDisplay (has 5V regulator on board that supplies the logic):

    • GND power source - GND
    • 12V power source - 12V

    *** DO NOT connect any 5V or 3.3V between Espruino and FlipDotDisplay - when Espruino powered (USB or Bat).***

    Flip-Dot-Display module though supports 5V at the 5V pin... which could be used to drive Espruino over its BAT in / USB. Powering Espruino from 5V of Flip-Dot-Display module allows to work with single 12V power supply...

    Code used to create attached clips:

    // flipDot00.js
    var nssPin = A0;   // nss pin                 for LAT (latching)
    var mosi   = B5;   // mosi / serial data pin  for SDA
    var sck    = B3;   // sck  / serial clock pin for SCL
    var spiFdd = SPI1; // SPI# compatible w/ mosi and sck pins for Flip Dot Display
    pinMode(nssPin,'output');
    nssPin.reset();
    spiFdd.setup({mosi:mosi, sck:sck}); // SPI1, other SPIx can do too
    function px(x,y,p) { // x(col),y(row),polarity 1/0 or true/false
       spiFdd.write((E.reverseByte(y | (x<<4))>>1) | ((!p) ? 128 : 8),nssPin);
    }
    function fdSetAll(p) {
      for (var c=0;c<5;c++) for (var r=0;r<7;r++) px(c,r,p);
      setTimeout(function(){nssPin.reset();},1­0); // de-power
    }
    n = 0;
    wi = null;
    function f(i) { // flip all every i milliseconds
      var p=false; if (wi) s(); wi = setInterval(function(){fdSetAll(p=!p);},­i);
    }
    function r(i) { // run thru byte w/ inc i // wi = true; in console before r()
      if (wi) s();
      wi = setInterval(function(){spiFdd.write(n=(n­+i)%256,nssPin);},0);
    }
    function s() { // s(); in console stops both, a() and r() and depowers
      if (wi && wi !== true) clearInterval(wi); wi = null; nssPin.reset();
    }
    

    PS: Great Thanks to @Mrbbp who provided me with two units to validate and have fun...


    4 Attachments

About

Avatar for allObjects @allObjects started