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,{zigzag: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();
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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: