I can use analogRead on pin D0 of the microbit ok, but setWatch does not seem work using the following code (this code works fine on classic Espruino to detect low to high voltage changes):-
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.
Hi Gordon,
I can use analogRead on pin D0 of the microbit ok, but setWatch does not seem work using the following code (this code works fine on classic Espruino to detect low to high voltage changes):-
function OnMotion()
{
console.log("Movement detected");
}
setWatch( OnMotion, D0, {repeat:true, edge:"rising"} );
Strangely when I call analogRead after setting the watch it seems to trigger the watch callback into action for one shot.
Regards
David