You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • 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.

    Yes, but it's easy enough to work around?

    var lastTime;
    var RPM;
    var w=setWatch(function(e) {
      RPM = 60 / (e.time - lastTime);
      lastTime = e.time;
      counter++;
      },
      pin,
      {repeat: 'true', edge:'rising'}
    );
    
About

Avatar for Gordon @Gordon started