HCSR04
with a electric imp?TypeError: this.io.pingRead is not a function
'use strict';
const five = require("johnny-five");
const Imp = require("imp-io");
const board = new five.Board({
io: new Imp({
agent: process.env.IMP_AGENT_ID
})
});
board.on("ready", function() {
let proximity = new five.Proximity({
controller: "HCSR04",
pin: 7
});
proximity.on("data", function() {
console.log("Proximity: ");
console.log(" cm : ", this.cm);
console.log(" in : ", this.in);
console.log("-----------------");
});
proximity.on("change", function() {
console.log("The obstruction has moved.");
});
});
Hey room... newb here. New to gitter and imp-io. Looking for some help with my Imp-io setup. My node app is crashing if my imp is not on and connectable. Is there something I'm missing here? Even when I use a try{} catch(e){} it still crashed my server.
Would like to be able to have it simply return an error I can log out.
Anyone know what to do here?
try{
var board = new five.Board({
io: new Imp({
agent: "############"
})
});
board.on("ready", function() {
var led = new five.Led(1);
led.blink(1000);
});
}
catch(e){
console.log("Can't connect to Imp")
}