I'm using the johnny-five node module on a Raspberry PI to drive a few servos on a robot with the following script
var five = require('johnny-five'), board, servo, led;
board = new five.Board();
board.on('ready', function(){
servo = new five.Servo({pin: 9, range:[0,180]});
// Allow direct commandline access
board.repl.inject({s: servo});
});
I get the following error when running this code on the Raspberry PI with node 0.10.29-1
1(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at process.EventEmitter.addListener (events.js:160:15)
at process.on.process.addListener (node.js:768:26)
at Board.broadcast (/home/pi/sonny/node_modules/johnny-five/lib/board.js:375:15)
at Board.<anonymous> (/home/pi/sonny/node_modules/johnny-five/lib/board.js:154:18)
at SerialPort.<anonymous> (/home/pi/sonny/node_modules/johnny-five/node_modules/firmata/lib/firmata.js:418:13)
at SerialPort.EventEmitter.emit (events.js:95:17)
at /home/pi/sonny/node_modules/johnny-five/node_modules/serialport/serialport.js:230:16
Need to setMaxListeners somewhere in the code.
If however I run this code on my notebook (Linux Mint 14 + node 0.10.20) it works fine.
Is there a way to setMaxListeners globally on the Raspberry PI (running raspbian)?
If not, how would I add setMaxListeners to my code?
This turned out to be a power issue with the raspberry pi. Once I put the motors on a separate power supply but with a common ground everything started working.