I'm trying to read data continuously from a sensor using node.js. Assuming my sensor is connected to digital pin 4 of Arduino, in the node side of the code how do I program it?
I did try this: Node.js code:
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
this.pinMode(4, five.Pin.INPUT);
this.loop(1,function(){
this.digitalRead(4, function(value) {
console.log(value);
});
});
});
This is the error that I got:
(node) warning: possible EventEmitter memory leak detected. 11 digital-read-4 listeners added. Use emitter.setMaxListeners() to increase limit. Trace at addListener (events.js:239:17) at Board.digitalRead (C:\Users\Rahul\Desktop\NodeServoTest\node_modules\johnny-five\node_modules\firmata\lib\firmata.js:827:8) at Board.(anonymous function) [as digitalRead] (C:\Users\Rahul\Desktop\NodeServoTest\node_modules\johnny-five\lib\board.js:495:21) at Board. (C:\Users\Rahul\Desktop\NodeServoTest\digitalRead.js:12:8) at wrapper [as _onTimeout] (timers.js:275:19) at Timer.listOnTimeout (timers.js:92:15)