you may need to take into account the timings of the dialing life cycle.
From your first line of the first post I assume that you have an 'old' rotary phone and you want to detect which digits and number it dialed (to drive a touch tone sequence?).
Remembering how rotary phones worked: when letting the disk go, the loaded spring pulls/rotates the disk it back in rest position with a constant angle speed. Angle speed is controlled - kept 'constant' / preventing from accelerating and running away - by a governor, either centrifugal friction or air resistance governor like they were used in old steam machines and still are used in spring driven music boxes. A combination of a single shot watch and timeouts as as key controls of a timing state machine may make it work:
if (h1) h1 = clearTimeout(h1);
This is just the core... some startup and end processing (clear watch and handles). There is most likely another switch that will tell when a dial is about to happen. A watch on that could be used to start the state machine.
Robust debouncing is a tough thing to do...
Versuchst du sowas anzuschliessen? Gelb-Gruen: Puls, Weiss-Braun: Ruheposition (?)
© Espruino, powered by microcosm.
Report a problem