Had time to try the mouse driver today. Here's the code:
//mymouse.js
// 15 Nov 2017
//
// Use pushbutton on pin B3 to reset
// Loads mouse driver into the USB boot
// Every second move mouse cursor by 20 pixels
// in a square pattern
//
//load and save the program
// unplug and replug the Pico USB
// mouse cursor should be moving in square pattern
// reconnect to WebIde
// mouse cursor still moving
// Type reset() in left pane of WebIde
// Type save() in left pane of WebIde
var mouse = require("USBMouse");
// A way back to normal just in case
var but1=B3;
setWatch(function(){
console.log("endit");
reset();
},but1, {debounce:100,repeat:true, edge:"falling"});
var i=0;
setInterval(function () {
//console.log(i);
switch (i){
case 0:
mouse.send(0, 20, mouse.BUTTONS.NONE); // X movement, Y movement,
break;
case 1:
mouse.send(20, 0, mouse.BUTTONS.NONE); // X movement, Y movement,
break;
case 2:
mouse.send(0, -20, mouse.BUTTONS.NONE); // X movement, Y movement,
break;
case 3:
mouse.send(-20, 0, mouse.BUTTONS.NONE); // X movement, Y movement,
break;
}
i++;
if( i>3) i=0;
}, 1000);
It's interesting that the WebIde still talks through the USB port with the mouse functions.
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.
Had time to try the mouse driver today. Here's the code:
It's interesting that the WebIde still talks through the USB port with the mouse functions.