I had a to change a few little bits. For example I had to remove the call to onInit(); other wise the serial on(data) was getting fired twice on boot which messed up the output.
I also added a frame per second counter for testing and I get a steady 25 fps!
My next task maybe to try and get this working over USB alone but if I need console access this might not be possible. maybe I could move console onto Bluetooth..
Here is the full code used in the video:
var fps = 0;
function onInit() {
SPI2.setup({baud:3200000, mosi:B15});
var cmd = "";
Serial3.setup(1000000, {tx:C10,rx:C11});
Serial3.on('data', function (data) {
cmd+=data;
var idx = cmd.indexOf("\1");
while (idx>=0) {
var line = cmd.substr(0,idx);
cmd = cmd.substr(idx+1);
idx = cmd.indexOf("\1");
SPI2.send4bit(line, 0b0001, 0b0011);
fps++;
}
});
var fps = setInterval(function() {
console.log('fps: ' + fps);
fps = 0;
}, 1000);
}
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.
I had a to change a few little bits. For example I had to remove the call to onInit(); other wise the serial on(data) was getting fired twice on boot which messed up the output.
I also added a frame per second counter for testing and I get a steady 25 fps!
My next task maybe to try and get this working over USB alone but if I need console access this might not be possible. maybe I could move console onto Bluetooth..
Here is the full code used in the video: