connect pin Vcc to 5V and try again.
Hint: Some use a voltage divider for the Echo pin and some don't, check this Google search
used code
/* ESP8266 */ var sensor = require("HC-SR04").connect(NodeMCU.D1,NodeMCU.D2,function(dist) { console.log(dist+" cm away"); }); /* PICO var sensor = require("HC-SR04").connect(B3,B4,function(dist) { console.log(dist+" cm away"); }); */ setInterval(function() { sensor.trigger(); // send pulse }, 500);
distance HC-SR04 to
@MaBe 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.
connect pin Vcc to 5V and try again.
Hint: Some use a voltage divider for the Echo pin and some don't, check this Google search
used code
distance HC-SR04 to