Yes, it can be zero - it's just whether buttons are pressed or not. I'll put definitions in the modules, but it's 1=left, 2=right, 4=middle - a bit like dealing with low-level GUI events tends to be :)
I think at some point the modules will need a bit of tidying - for instance making sure you can actually print a line of text to the Keyboard.
As a fun aside, you can now do something like this:
var kb = require("USBKeyboard");
var data = [];
setInterval(function() {
if (data.length>=40) data = data.slice(-39);
data.push(E.getTemperature());
}, 1000);
function outputData() {
var i = 0;
function outputLine() {
if (i>=data.length) return;
var s = data[i++].toFixed(2)+",\n";
kb.type(s, outputLine);
}
outputLine();
}
setWatch(outputData, BTN, {debounce:100,repeat:true, edge:"rising"});
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.
Yes, it can be zero - it's just whether buttons are pressed or not. I'll put definitions in the modules, but it's 1=left, 2=right, 4=middle - a bit like dealing with low-level GUI events tends to be :)
I think at some point the modules will need a bit of tidying - for instance making sure you can actually
print
a line of text to the Keyboard.As a fun aside, you can now do something like this:
I'll post a link to the latest version in a bit