• further to this, now I have set it up to only trigger on button 1 press, each time it is pressed it returns several times:

    Code:

    var sensor = require("HC-SR04").connect(A2,A3,function(dist) {
      console.log("response "+Math.floor(dist)+" cm away");
    });
    
    function runIt(){
      console.log("button pressed");
      sensor.trigger();
    }
    
    runIt();
    
    setWatch(runIt, BTN1, {repeat:true, edge:"rising"});
    
    

    Results:

    
    button pressed
    response 27015 cm away
    response 11 cm away
    response 13 cm away
    response 109 cm away
    

    I would expect one response per trigger, or am I missing something?

About

Avatar for Rek @Rek started