Skip to content
This repository was archived by the owner on Feb 28, 2019. It is now read-only.

Quick Start Guide on CommProtocol Usage

JasonZell edited this page Feb 17, 2018 · 1 revision

Example Code

// Initialization
const uint8_t CommID = 1; // User defined, UNIQUE CommNode ID ( per Xbee)
const uint8_t destCommID = 2; // Unique CommNode ID of the recipient of packets.
const char* comPortName = "COM10"; // The port number that Xbee is plug into(changes all the time, always check XCTU).
const char* destMac = "0013A20040917A31"; // Recipient XBee MAC Address
const uint32_t baudRate = 57600 // Baudrate, should be same across the board for all XBees

comnet::Comms GCSNode(commID); // initialize CommNode
GCSNode.LoadKey("01234567890ABCDEF"); // Add AES Key for encryption
GCSNode.InitConnection(ZIGBEE_LINK, comPortName, "", baudRate); // ZIGBEE_LINK means packet goes through Xbee, 
GCSNode.AddAddress(destCommID , destMac ) // Add recipient CommNode ID and MAC Address.

GCSNode.LinkCallback(new Packet(), new comnet::Callback((comnet::callback_t)CallBackFunc)); //link callback to CommNode.
GCSNode.Run(); // Must call Run() before sending anything.

// Sending packet
Packet data("Message");
GCSNode.Send(data, destCommID );

Clone this wiki locally