jankolkmeier / svd-xbee

Node talks to xbee radios through serialport
40 stars 14 forks source link

readme example #12

Open imahumanfly opened 11 years ago

imahumanfly commented 11 years ago

Actual code


var XBee = require('svd-xbee');

var xbee = new XBee({
  port: 'COM3',   // replace with yours
  baudrate: 9600 // 9600 is default
}).init();

var robot = xbee.addNode([0x00,0x13,0xa2,0x00,0x40,0x61,0xaa,0xe2]);

var robot.on("data", function(data) {
    console.log("robot>", data);
    if (data == "ping") robot.send("pong");
});

shouldn't be this?


var XBee = require('svd-xbee').XBee;

var xbee = new XBee({
  port: 'COM3',   // replace with yours
  baudrate: 9600 // 9600 is default
}).init();

var robot = xbee.addNode([0x00,0x13,0xa2,0x00,0x40,0x61,0xaa,0xe2]);

robot.on("data", function(data) {
    console.log("robot>", data);
    if (data == "ping") robot.send("pong");
});
jankolkmeier commented 11 years ago

yep, well spotted! On Aug 29, 2013 12:22 AM, "Javier" notifications@github.com wrote:

Actual code

var XBee = require('svd-xbee'); var xbee = new XBee({ port: 'COM3', // replace with yours baudrate: 9600 // 9600 is default}).init(); var robot = xbee.addNode([0x00,0x13,0xa2,0x00,0x40,0x61,0xaa,0xe2]); var robot.on("data", function(data) { console.log("robot>", data); if (data == "ping") robot.send("pong");});

shouldn't be this?

var XBee = require('svd-xbee').XBee; var xbee = new XBee({ port: 'COM3', // replace with yours baudrate: 9600 // 9600 is default}).init(); var robot = xbee.addNode([0x00,0x13,0xa2,0x00,0x40,0x61,0xaa,0xe2]); robot.on("data", function(data) { console.log("robot>", data); if (data == "ping") robot.send("pong");});

— Reply to this email directly or view it on GitHubhttps://github.com/jouz/svd-xbee/issues/12 .