//example #1
var step = 0;
function encFun(){
var a = digitalRead(C6);
var b = digitalRead(C8);
// print('a', a);
// print('b', b);
if (a == HIGH && b == LOW){
step ++;
print(step);
return;
}
else if (a == HIGH && b == HIGH){
step --;
print(step);
return;
}
}
setWatch(encFun, C6, true);
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.