Initialization
Before starting to use a module, it needs to be initialized. During this process, the UART to communicate with the module has to be opened and the XBee switch has to be set on.

Setting ON

The ON() function initializes all the global variables, opens the correspondent UART and switches the XBee ON. The baud rate used to open the UART is defined on the library (115200 bps by default).
It returns nothing.
The initialized variables are:
protocol : specifies the protocol used • pos : specifies the position to use in received packets • discoveryOptions : specifies the options in Node Discovery • awakeTime : specifies the time to be awake before go sleeping • sleepTime : specifies the time to be sleeping • scanChannels : specifies the channels to scan • scanTime : specifies the time to scan each channel • timeEnergyChannel : specifies the time the channels will be scanned • encryptMode : specifies if encryption mode is enabled • powerLevel : specifies the power transmission level • timeRSSI : specifies the time RSSI LEDs are on • sleepOptions : specifies the options for sleeping • parentNA : specifies the address of the parent • deviceType : specifies the type of the device • extendedPAN : specifies the extended PAN ID • maxUnicastHops : specifies the maximum number of hops in a Unicast transmission • maxBroadcastHops : specifies the maximum number of hops in a Broadcast transmission • stackProfile : specifies the stack of ZigBee protocol used • joinTime : specifies the time the Coordinator allows nodes joining the network • channelVerification : specifies if the router needs a Coordinator to maintain in the network • joinNotification : specifies is a message is sent when a node joins the network • aggregateNotification : specifies the time between consecutive aggregate route broadcast messages • encryptOptions : specifies the options for encryption mode • networkKey : specifies the network key • powerMode : specifies the power mode used
Example of use
{
xbeeZB.ON();
}

Setting OFF

The OFF() function closes the UART and switches the XBee OFF.
Example of use
{
xbeeZB.OFF();
}
Copy link