• In the topic of setWatch limitation - I have a strange behaviour of setWatch.
    I'm using rotary encoder (not the poteniometer, but the one you install on motor to read impulses).

      let count = 0;
      pinMode(cfg.pin.encoder1, "input_pulldown");
      setWatch(() => {
        const state = digitalRead(cfg.pin.encoder1);
        if (state === 1)
      }, cfg.pin.encoder1, { repeat: true, edge: "rising" });
      setInterval(() => {
        count = 0;
      }, 1000);

    Code should count impulses per second, and it does. However strange thing is that at low speed it counts 45-50 impulses, at high speed (~x2) it counts 43-48 impulses. Clearly expectation was quite the opposite:)

    Assuming code and wiring is ok - I was wondering if maybe I'm hitting speed limitation of Espruino - which is simply not able to process frequently enough impulses.

    I'm using ESP32 and Espruino 2.04


Avatar for AkosLukacs @AkosLukacs started