• I have started my first project, I am new to electronics but an old hand at coding.

    I have 5v regulated DC power connected to my circuit (not via the espruino 5v), espruno is powered via USB, I am running code via the API

    I am making a RGB LED strip change color depending on distance measured by ultrasonic echo.

    I am just experimenting with the sensor module:

    var sensor = require("HC-SR04").connect(A0,A2,function(dist) {
      console.log("response "+Math.floor(dist)+" cm away");
    });
    

    Now this seems to continuously send output after loaded until you trigger it via:

    sensor.trigger();
    

    Does anyone know why this is?

    Also, I seem to be getting very random results that don't have anything to do with putting an object in front of the sensor when I use setInterval, I have wired it up as described here http://www.espruino.com/HC-SR04

    If anyone has experience with this sensor I would love some pointers.

About

Avatar for Rek @Rek started