i've corrected my pb with an ugly trick but it works as i need.
it sends through the serial : 1 for clockwise and pulse Green led -1 for conterclockwise and pulse Red led
function onInit() {
var step = 0;
var final = 0;
require("Encoder").connect(A5, A8, (temp) => {
step += temp;
if (Math.floor(step / 4) == step / 4) {
(step > 0) ? dir = 1: dir = -1;
step = 0;
(dir > 0) ?digitalPulse(LED1, 1, 20):digitalPulse(LED2, 1, 20);
print(dir);
}
});
}
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've corrected my pb with an ugly trick but it works as i need.
it sends through the serial :
1
for clockwise and pulse Green led-1
for conterclockwise and pulse Red led