Node.js(上Ubuntu)解決使用的XBee API的校驗和不匹配錯誤使用XBee API庫作爲ZigBee協調API將數據發送到的XBee的ZigBee路由器每隔一分鐘。 10分鐘就可以了,但在此之後它報告了一個錯誤:如何在Node.js的
Error: Checksum Mismatch
我該如何解決這個問題?
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("COM19", {
baudrate: 57600,
parser: xbeeAPI.rawParser()
});
serialport.on("open", function() {
var frame_obj = {
type: 0x10, // xbee_api.constants.FRAME_TYPE.ZIGBEE_TRANSMIT_REQUEST
id: 0x01, // Optional, nextFrameId() is called per default
destination64: "0013a200400a0127",
destination16: "fffe", // Optional, "fffe" is default
broadcastRadius: 0x00, // Optional, 0x00 is default
options: 0x00, // Optional, 0x00 is default
data: "TxData0A" // Can either be a string or byte array.
};
serialport.write(xbeeAPI.buildFrame(frame_obj));
});
// All frames parsed by the XBee will be emitted here
xbeeAPI.on("frame_object", function(frame) {
console.log(">>", frame);
});