Can't send message
imahumanfly opened this issue · comments
I'm getting this error after receiving the first message and trying to send "pong".
Output:
robot> ping
/home/pi/nodeXbee/node_modules/svd-xbee/lib/xbee-api.js:248
payload.push(this.destination16[i]);
^
TypeError: Cannot read property '0' of undefined
at TransmitRFData.getPayload (/home/pi/nodeXbee/node_modules/svd-xbee/lib/xbee-api.js:248:36)
at Packet.getBytes (/home/pi/nodeXbee/node_modules/svd-xbee/lib/xbee-api.js:83:24)
at XBee.send (/home/pi/nodeXbee/node_modules/svd-xbee/index.js:327:19)
at Node.send (/home/pi/nodeXbee/node_modules/svd-xbee/index.js:529:13)
at Node.<anonymous> (/home/pi/nodeXbee/app.js:15:15)
at Node.EventEmitter.emit (events.js:98:17)
at Node._onReceivePacket (/home/pi/nodeXbee/node_modules/svd-xbee/index.js:503:13)
at SerialPort.self._onReceivePacket (/home/pi/nodeXbee/node_modules/svd-xbee/index.js:188:35)
at SerialPort.EventEmitter.emit (events.js:95:17)
at Object.parser (/home/pi/nodeXbee/node_modules/svd-xbee/lib/xbee-api.js:336:21)
Code:
var XBee = require('svd-xbee').XBee;
var xbee = new XBee({
port: '/dev/ttyUSB0',
baudrate: 9600
}).init();
var robot = xbee.addNode([0x00,0x13,0xa2,0x00,0x40,0xa8,0x21,0x03]);
robot.on("data", function(data) {
console.log("robot>", data);
if (data == "ping") robot.send("pong");
});
I found something odd in index.js that might explain it. Could you check out the latest commit from here and see if it's fixed?
Thanks, it works now.
is it possible to get the lib updated with the latest code via npm?
i'll publish this fix in some minutes on npm
On Aug 28, 2013 10:13 PM, "Javier" notifications@github.com wrote:
Thanks, it works now.
is it possible to get the lib updated with the latest code via npm?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/11#issuecomment-23443717
.