You are reading a single comment by @Owen and its replies. Click here to read the full conversation.
  • I'm trying to use Espruino as the controller to take LED matrix data from the Glediator over USB and output it onto an RGB LED matrix.
    The Matrix is made up on 16x8 WS2812B pixels. I've attached the example code from Glediator for using an Arduino as the controller which I've tried ported to JS (see below).
    I've tried using the example USART code from here: along with other code I found on the forum but so far nothing has worked. Is there something I'm missing in the code below? I'm unsure if data is being received but Espruino as I can't connect while data is being sent to check.

        function onInit() {
          SPI2.setup({baud:3200000, mosi:B15});
          var m = Graphics.createArrayBuffer(16,8,24,{zigz­ag:true,color_order:'bgr'});
          m.flip = function(){ SPI2.send4bit(m.buffer, 0b0001, 0b0011); }; // Not sure if I need this line?
        function portData() {
          USB.on('data', function (data) {
            var idx = cmd.indexOf("\r");
            while (idx>=0) { 
              var line = cmd.substr(0,idx);
              cmd = cmd.substr(idx+1);
              var s = "'"+line+"' = "+eval(line); 
              idx = cmd.indexOf("\r");
              SPI2.send4bit(cmd, 0b0001, 0b0011);

    1 Attachment


Avatar for Owen @Owen started