-
Mon 2019.08.12
Hi @pankleks, I recently thought (wrongly) that setWatch() was problematic. Gordon demonstrated a solution with the following snippet:
It is likely that the Javascript needed to process the digitalRead() is the issue. My really rough timing observation is that Espruino needs around 50usec overhead to make the call, and another variable amount to get the rest of the instructions processed. I'm clocking data accurately with 2usec pulse width, 500KHz spaced at tenth second intervals.
Are there any setIntervals() running?
What does the datasheet show for max readings?
Are we Absolutely certain that the interface electronics is as needed and that 'pull down' is the appropriate mode?
Both devices share a common ground?
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).
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