You are reading a single comment by @Owen and its replies. Click here to read the full conversation.
  • Part success!
    I've got Serial3 receiving data, issue appeared to be that I needed to give the pins in Serial3.setup
    I ran many tests and passed it simple test strings to confirm that it was working and the while() loop would wait until it saw \r
    Now I've begun passing it the matrix data from Glediator and..part success. The serial data is being received and using SPI2.send4bit I push it out onto the matrix. But the matrix lights up crazy, see the photo below.

    Now as crazy as it is, the movement of the pixels and overall colour does match that from Glediator so I'm thinking the issue is more to do with me not correctly finding the beginning of the data. If it is not \r what else could it be?
    Or is there something else I'm missing completely? I've attached my full code below:

      function onInit() {
        SPI2.setup({baud:3200000, mosi:B15});
        var m = Graphics.createArrayBuffer(15,15,24,{zig­zag:true,color_order:'bgr'});
        m.flip = function(){ SPI2.send4bit(m.buffer, 0b0001, 0b0011); };
        
        var cmd = "";
        Serial3.setup(1000000, {tx:C10,rx:C11});
        Serial3.on('data', function (data) {
          cmd+=data;
          var idx = cmd.indexOf("\r");
          while (idx>=0) {
            var line = cmd.substr(0,idx);
            cmd = cmd.substr(idx+1);
            idx = cmd.indexOf("\r");
            SPI2.send4bit(line, 0b0001, 0b0011);    
          }
        });
      }
      onInit(); 
    
About

Avatar for Owen @Owen started