I want nodejs to send and receive messages with xbee. I know that the xbee setup works because I tested it on x-ctu. I tried the following but can't receive the message. It says it's open.
var util = require('util');
var SerialPort = require('serialport').SerialPort;
var xbee_api = require('xbee-api');
var C = xbee_api.constants;
var xbeeAPI = new xbee_api.XBeeAPI({
api_mode: 1
});
var serialport = new SerialPort("COM7", {
baudrate: 9600,
parser: xbeeAPI.parseRaw(1000)
});
serialport.on("open", function() {
console.log("open");
});
// All frames parsed by the XBee will be emitted here
//I think this is the problem
xbeeAPI.on("frame_object", function(frame) {
console.log(">>", frame);
});