• I would maybe avoid calling flowSensor[0].on('pulse', function () {} at all, even if the function has no code.

    It looks like Amperka's library isn't expecting the number of pulses per second that you are getting from your sensors. In fact looking at it the whole thing is really inefficient if you have even 100 pulses/second.

    You could just try using something like this instead:

    function waterFlow(pin) {
      var lastPulses = 0, pulses = 0;
      var total = 0;
      setWatch(function(){pulses++},pin, {repeat: true, edge: 'rising'});
      setInterval(function() {
        total += pulses;
        lastPulses = pulses;
        pulses = 0;
      }, 10000);
      return {
        volume : function() { return total; },
        speed : function() { return lastPulses; }

    Although you'd have to apply some scale factors to volume and speed.

  • You could just try using something like this instead

    Thanks, It's quite simple and more clear for me.
    I implemented the code, but after some time I again recieve "New interpreter error: FIFO_FULL"
    It's important to mention that no sensors are connected to the pins (I do testing at home without any sensors) A0 and A1


Avatar for Gordon @Gordon started