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?
@Rek started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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:
Results:
I would expect one response per trigger, or am I missing something?