You are reading a single comment by @avanc and its replies. Click here to read the full conversation.
  • Sorry, I don't understand the discussion regard reed switch or not.

    I modified the code so that the interval timer is deactivate if the speed is 0. It's activated again by the first rotation: https://github.com/avanc/espruino-tachomĀ­eter/blob/master/tachometer.js

    @Gordon: Is it not cheaper to calculate the speed just every few seconds than adding more logic into each wheel turn? In addition, caluclating the time in the watch function, I get some problems:

    lastTime is the time in seconds at which the pin last changed state. When using edge:'rising' or edge:'falling', this is not the same as when the function was last called.

About

Avatar for avanc @avanc started