├── .gitignore ├── .project ├── COPYING ├── Doxyfile ├── LICENSE ├── Printers.cpp ├── Printers.h ├── README.md ├── XBee.cpp ├── XBee.h ├── build.xml ├── docs ├── .gitignore └── api │ ├── _x_bee_8h-source.html │ ├── _x_bee_8h_source.html │ ├── annotated.html │ ├── bc_s.png │ ├── bdwn.png │ ├── class_at_command_request-members.html │ ├── class_at_command_request.html │ ├── class_at_command_request.png │ ├── class_at_command_response-members.html │ ├── class_at_command_response.html │ ├── class_at_command_response.png │ ├── class_frame_id_response-members.html │ ├── class_frame_id_response.html │ ├── class_frame_id_response.png │ ├── class_modem_status_response-members.html │ ├── class_modem_status_response.html │ ├── class_modem_status_response.png │ ├── class_payload_request-members.html │ ├── class_payload_request.html │ ├── class_payload_request.png │ ├── class_remote_at_command_request-members.html │ ├── class_remote_at_command_request.html │ ├── class_remote_at_command_request.png │ ├── class_remote_at_command_response-members.html │ ├── class_remote_at_command_response.html │ ├── class_remote_at_command_response.png │ ├── class_rx16_io_sample_response-members.html │ ├── class_rx16_io_sample_response.html │ ├── class_rx16_io_sample_response.png │ ├── class_rx16_response-members.html │ ├── class_rx16_response.html │ ├── class_rx16_response.png │ ├── class_rx64_io_sample_response-members.html │ ├── class_rx64_io_sample_response.html │ ├── class_rx64_io_sample_response.png │ ├── class_rx64_response-members.html │ ├── class_rx64_response.html │ ├── class_rx64_response.png │ ├── class_rx_data_response-members.html │ ├── class_rx_data_response.html │ ├── class_rx_data_response.png │ ├── class_rx_io_sample_base_response-members.html │ ├── class_rx_io_sample_base_response.html │ ├── class_rx_io_sample_base_response.png │ ├── class_rx_response-members.html │ ├── class_rx_response.html │ ├── class_rx_response.png │ ├── class_tx16_request-members.html │ ├── class_tx16_request.html │ ├── class_tx16_request.png │ ├── class_tx64_request-members.html │ ├── class_tx64_request.html │ ├── class_tx64_request.png │ ├── class_tx_status_response-members.html │ ├── class_tx_status_response.html │ ├── class_tx_status_response.png │ ├── class_x_bee-members.html │ ├── class_x_bee.html │ ├── class_x_bee_address-members.html │ ├── class_x_bee_address.html │ ├── class_x_bee_address.png │ ├── class_x_bee_address64-members.html │ ├── class_x_bee_address64.html │ ├── class_x_bee_address64.png │ ├── class_x_bee_request-members.html │ ├── class_x_bee_request.html │ ├── class_x_bee_request.png │ ├── class_x_bee_response-members.html │ ├── class_x_bee_response.html │ ├── class_x_bee_response.png │ ├── class_z_b_rx_io_sample_response-members.html │ ├── class_z_b_rx_io_sample_response.html │ ├── class_z_b_rx_io_sample_response.png │ ├── class_z_b_rx_response-members.html │ ├── class_z_b_rx_response.html │ ├── class_z_b_rx_response.png │ ├── class_z_b_tx_request-members.html │ ├── class_z_b_tx_request.html │ ├── class_z_b_tx_request.png │ ├── class_z_b_tx_status_response-members.html │ ├── class_z_b_tx_status_response.html │ ├── class_z_b_tx_status_response.png │ ├── classes.html │ ├── closed.png │ ├── doxygen.css │ ├── doxygen.png │ ├── dynsections.js │ ├── files.html │ ├── ftv2blank.png │ ├── ftv2doc.png │ ├── ftv2folderclosed.png │ ├── ftv2folderopen.png │ ├── ftv2lastnode.png │ ├── ftv2link.png │ ├── ftv2mlastnode.png │ ├── ftv2mnode.png │ ├── ftv2node.png │ ├── ftv2plastnode.png │ ├── ftv2pnode.png │ ├── ftv2splitbar.png │ ├── ftv2vertline.png │ ├── functions.html │ ├── functions_func.html │ ├── hierarchy.html │ ├── index.html │ ├── jquery.js │ ├── nav_f.png │ ├── nav_g.png │ ├── nav_h.png │ ├── open.png │ ├── sync_off.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_b.gif │ ├── tab_b.png │ ├── tab_h.png │ ├── tab_l.gif │ ├── tab_r.gif │ ├── tab_s.png │ └── tabs.css ├── doxygen-docs.sh ├── examples ├── AtCommand │ └── AtCommand.pde ├── Echo_Callbacks │ └── Echo_Callbacks.ino ├── RemoteAtCommand │ └── RemoteAtCommand.pde ├── Series1_IoSamples │ └── Series1_IoSamples.pde ├── Series1_Rx │ └── Series1_Rx.pde ├── Series1_Tx │ └── Series1_Tx.pde ├── Series2_IoSamples │ └── Series2_IoSamples.pde ├── Series2_Rx │ └── Series2_Rx.pde ├── Series2_Rx_Nss │ └── Series2_Rx_Nss.pde ├── Series2_Sleep │ └── Series2_Sleep.pde ├── Series2_Tx │ └── Series2_Tx.pde └── ZdpScan │ ├── ZdpScan.ino │ └── zigbee.h ├── keywords.txt ├── library.json └── library.properties /.gitignore: -------------------------------------------------------------------------------- 1 | /notes.txt 2 | /deploy.sh 3 | /.DS_Store 4 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | xbee-arduino 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | ?name? 14 | 15 | 16 | 17 | org.eclipse.cdt.make.core.append_environment 18 | true 19 | 20 | 21 | org.eclipse.cdt.make.core.autoBuildTarget 22 | all 23 | 24 | 25 | org.eclipse.cdt.make.core.buildArguments 26 | 27 | 28 | 29 | org.eclipse.cdt.make.core.buildCommand 30 | make 31 | 32 | 33 | org.eclipse.cdt.make.core.buildLocation 34 | ${workspace_loc:/xbee-arduino/Debug} 35 | 36 | 37 | org.eclipse.cdt.make.core.cleanBuildTarget 38 | clean 39 | 40 | 41 | org.eclipse.cdt.make.core.contents 42 | org.eclipse.cdt.make.core.activeConfigSettings 43 | 44 | 45 | org.eclipse.cdt.make.core.enableAutoBuild 46 | false 47 | 48 | 49 | org.eclipse.cdt.make.core.enableCleanBuild 50 | true 51 | 52 | 53 | org.eclipse.cdt.make.core.enableFullBuild 54 | true 55 | 56 | 57 | org.eclipse.cdt.make.core.fullBuildTarget 58 | all 59 | 60 | 61 | org.eclipse.cdt.make.core.stopOnError 62 | true 63 | 64 | 65 | org.eclipse.cdt.make.core.useDefaultBuildCmd 66 | true 67 | 68 | 69 | 70 | 71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 72 | 73 | 74 | 75 | 76 | 77 | org.eclipse.cdt.core.cnature 78 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 79 | org.eclipse.cdt.core.ccnature 80 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 81 | 82 | 83 | -------------------------------------------------------------------------------- /Printers.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #ifndef XBee_Printers_h 21 | #define XBee_Printers_h 22 | 23 | #if defined(ARDUINO) && ARDUINO >= 100 24 | #include "Arduino.h" 25 | #else 26 | #include "WProgram.h" 27 | #endif 28 | 29 | #include "XBee.h" 30 | 31 | // Need to define global variables to allow PROGMEM pointers as default 32 | // arguments below. Since these variables are const, there won't be any 33 | // linker conflicts from defining these in a header file. 34 | const char default_byte_sep_arr[] PROGMEM = " "; 35 | const char default_group_sep_arr[] PROGMEM = "\r\n"; 36 | const __FlashStringHelper * const default_byte_sep = (const __FlashStringHelper*)default_byte_sep_arr; 37 | const __FlashStringHelper * const default_group_sep = (const __FlashStringHelper*)default_group_sep_arr; 38 | 39 | /** 40 | * Print a buffer byte-by-byte. Each byte is separated by byte_sep and 41 | * every group_by bytes are separated by group_sep instead. 42 | * 43 | * For example, to print 8 bytes per line, each byte separated by a 44 | * newline, to Serial: 45 | * 46 | * printHex(Serial, buf, len, F(" "), F("\r\n"), 8); 47 | * 48 | * Values shown are also the defaults. 49 | * 50 | * Pass NULL as group_by or byte_sep to not have that separator. 51 | */ 52 | void printHex(Print& p, const uint8_t* buf, size_t len, const __FlashStringHelper* byte_sep = default_byte_sep, const __FlashStringHelper* group_sep = default_group_sep, size_t group_by = 8); 53 | 54 | /** 55 | * Print a single byte, in hex, using a leading zero if needed. 56 | */ 57 | inline void printHex(Print& p, uint8_t v) { 58 | // Add leading zero if needed 59 | if (v < 0x10) 60 | p.write('0'); 61 | p.print(v, HEX); 62 | } 63 | 64 | /** 65 | * Print a 16 bit integer, in hex, using leading zeroes if needed. 66 | */ 67 | inline void printHex(Print& p, uint16_t v) { 68 | printHex(p, (uint8_t)(v >> 8)); 69 | printHex(p, (uint8_t)v); 70 | } 71 | 72 | /** 73 | * Print a 32 bit integer, in hex, using leading zeroes if needed. 74 | */ 75 | inline void printHex(Print& p, uint32_t v) { 76 | printHex(p, (uint16_t)(v >> 16)); 77 | printHex(p, (uint16_t)v); 78 | } 79 | 80 | /** 81 | * Print a 64-bit address, in hex, using leading zeroes if needed. 82 | */ 83 | inline void printHex(Print& p, XBeeAddress64 v) { 84 | printHex(p, v.getMsb()); 85 | printHex(p, v.getLsb()); 86 | } 87 | 88 | // The following functions are intended to be used as callbacks, to 89 | // print various information about received responses. All of the 90 | // require a Print* to be passed as the data parameter. For example, to 91 | // print to Serial any TxStatusResponses that contain errors, do: 92 | // 93 | // xbee.onTxStatusResponse(printErrorCb, (uintptr_t)(Print*)&Serial); 94 | // 95 | // Most of these callbacks can either be used as a response-specific 96 | // callback, to only work that specific API response type, or as a 97 | // generic callback (onResponse or onOtherResponse), in which case the 98 | // relevant version of the callback will be called automatically. 99 | 100 | // printErrorCb prints any error messages in status responses. 101 | void printErrorCb(uint8_t code, uintptr_t data); 102 | void printErrorCb(ZBTxStatusResponse& r, uintptr_t data); 103 | void printErrorCb(TxStatusResponse& r, uintptr_t data); 104 | void printErrorCb(AtCommandResponse& r, uintptr_t data); 105 | void printErrorCb(RemoteAtCommandResponse& r, uintptr_t data); 106 | void printErrorCb(XBeeResponse& r, uintptr_t data); 107 | 108 | // printRawResponseCb prints the raw bytes of a response. 109 | void printRawResponseCb(XBeeResponse& response, uintptr_t data); 110 | 111 | // printResponseCb prints a human-readable version of a response, showing 112 | // the values of all fields individually. 113 | void printResponseCb(ZBTxStatusResponse& status, uintptr_t data); 114 | void printResponseCb(ZBRxResponse& rx, uintptr_t data); 115 | void printResponseCb(ZBExplicitRxResponse& rx, uintptr_t data); 116 | void printResponseCb(ZBRxIoSampleResponse& rx, uintptr_t data); 117 | void printResponseCb(TxStatusResponse& status, uintptr_t data); 118 | void printResponseCb(Rx16Response& rx, uintptr_t data); 119 | void printResponseCb(Rx64Response& rx, uintptr_t data); 120 | void printResponseCb(Rx16IoSampleResponse& rx, uintptr_t data); 121 | void printResponseCb(Rx64IoSampleResponse& rx, uintptr_t data); 122 | void printResponseCb(ModemStatusResponse& status, uintptr_t data); 123 | void printResponseCb(AtCommandResponse& at, uintptr_t data); 124 | void printResponseCb(RemoteAtCommandResponse& at, uintptr_t data); 125 | void printResponseCb(XBeeResponse& r, uintptr_t data); 126 | 127 | // The following functions are non-callback version of the above, 128 | // intended to be called with Print instance (such as Serial) directly, 129 | // saving the casts. 130 | 131 | // Print any error in these status response (prints nothing when the 132 | // status is ok). 133 | inline void printError(ZBTxStatusResponse& r, Print& print) { printErrorCb(r, (uintptr_t)(Print*)&print); } 134 | inline void printError(TxStatusResponse& r, Print& print) { printErrorCb(r, (uintptr_t)(Print*)&print); } 135 | inline void printError(AtCommandResponse& r, Print& print) { printErrorCb(r, (uintptr_t)(Print*)&print); } 136 | inline void printError(RemoteAtCommandResponse& r, Print& print) { printErrorCb(r, (uintptr_t)(Print*)&print); } 137 | inline void printError(XBeeResponse& r, Print& print) { printErrorCb(r, (uintptr_t)(Print*)&print); } 138 | 139 | // Print the raw bytes of a response 140 | inline void printRawResponse(XBeeResponse& r, Print& print) { printRawResponseCb(r, (uintptr_t)(Print*)&print); } 141 | 142 | // Print a human-readable version of a response 143 | inline void printResponse(ZBTxStatusResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 144 | inline void printResponse(ZBRxResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 145 | inline void printResponse(ZBExplicitRxResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 146 | inline void printResponse(ZBRxIoSampleResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 147 | inline void printResponse(TxStatusResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 148 | inline void printResponse(Rx16Response& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 149 | inline void printResponse(Rx64Response& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 150 | inline void printResponse(Rx16IoSampleResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 151 | inline void printResponse(Rx64IoSampleResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 152 | inline void printResponse(ModemStatusResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 153 | inline void printResponse(AtCommandResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 154 | inline void printResponse(RemoteAtCommandResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 155 | inline void printResponse(XBeeResponse& r, Print& print) { printResponseCb(r, (uintptr_t)(Print*)&print); } 156 | #endif // XBee_Printers_h 157 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # xbee-arduino 2 | 3 | Arduino library for communicating with XBees in API mode, with support for both Series 1 (802.15.4) and Series 2 (ZB Pro/ZNet). This library Includes support for the majority of packet types, including: TX/RX, AT Command, Remote AT, I/O Samples and Modem Status. 4 | 5 | 6 | ## News 7 | 8 | * 11/18/15 Matthijs Kooijman's new book, [Building Wireless Sensor Networks Using Arduino](http://www.amazon.com/gp/product/1784395587/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1784395587&linkCode=as2&tag=xbapra-20&linkId=CEH23GT6ZPOT4ZH4) is now available. He covers the fundamentals of working with XBees in API mode, including some advanced topics (encryption, security, sleep), as well as creating projects with this library. 9 | * 9/15/15 Matthijs Kooijman has contributed numerous enhancements to the library, including callbacks, enhanced debugging, added features and bug fixes! These can be found in the 0.6.0 release. 10 | * 2/28/15 The code is now on github as the googlecode has shutdown 11 | * 2/1/14 Release 0.5 is available. This is essentially the 0.4 Software Serial release with a bug fix or two. If upgrading from a version prior to 0.4, please note that the method for specifying the serial port has changed; see See SoftwareSerialReleaseNotes. Along with this release I have converted the repository from Subversion to Git 12 | * 10/15/12 Release 0.4 (beta) is available. Paul Stoffregen (Teensy creator) has contributed a patch that allows for using SoftwareSerial? for XBee communication! This frees up the Serial port for debug or to use with other hardware. Try it out and report any issues on the Google group page. Important: See SoftwareSerialReleaseNotes as it was necessary to change the API to support this feature. 13 | * 12/21/11 Release 0.3 is now available. This release includes support for Arduino 1.0 along with some bug fixes and a new setSerial function for using alternate serial ports (e.g. Mega). This release is compatible with previous Arduino releases as well. 14 | * 4/3/11 I have created an XBeeUseCases wiki on XBee API that describes several use cases for communicating with XBees. 15 | * 11/14/09 Version 0.2.1 is available. This release contains a bug fix for Remote AT 16 | * 10/26/09 XBee-Arduino 0.2 is now available. This release adds support for AT Command, Remote AT, and I/O sample (series 1 and 2) packets. Along with this release I have created several new examples. 17 | * 8/09/09 I have released Droplet, a wireless LCD display/remote control with support for Twitter, Google Calendar, weather etc. It uses this software to send and receive XBee packets. 18 | * 4/19/09 Release 0.1.2: In this release I added some abbreviated constructors for creating basic Requests and get/set methods to facilitate the reuse of Requests 19 | * 3/29/09 Initial Release 20 | 21 | ## Documentation 22 | Doxygen API documentation is available in the downloads. Unfortunately it is not available online anymore as Git does not support the html mime type as Subversion does 23 | 24 | [Developer's Guide](https://github.com/andrewrapp/xbee-arduino/blob/wiki/DevelopersGuide.md) 25 | 26 | [XBee API (Java) Project](https://github.com/andrewrapp/xbee-api) Although this project is a Java implementation, it contains a few wikis relevant to this project, including xbee configuration and use cases. 27 | 28 | [Google Group](https://groups.google.com/forum/#!forum/xbee-api) 29 | 30 | ## Example 31 | I have created several sketches of sending/receiving packets with Series 1 and 2 XBee radios. You can find these in the examples folder. Here's an example of sending a packet with a Series 2 radio: 32 | 33 | ``` 34 | // Create an XBee object at the top of your sketch 35 | XBee xbee = XBee(); 36 | 37 | // Start the serial port 38 | Serial.begin(9600); 39 | // Tell XBee to use Hardware Serial. It's also possible to use SoftwareSerial 40 | xbee.setSerial(Serial); 41 | 42 | // Create an array for holding the data you want to send. 43 | uint8_t payload[] = { 'H', 'i' }; 44 | 45 | // Specify the address of the remote XBee (this is the SH + SL) 46 | XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x403e0f30); 47 | 48 | // Create a TX Request 49 | ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload)); 50 | 51 | // Send your request 52 | xbee.send(zbTx); 53 | ``` 54 | 55 | See the examples folder for the full source. There are more examples in the download. 56 | 57 | See the XBee API project for Arduino < - > Computer communication. 58 | 59 | To add XBee support to a new sketch, add "#include " (without quotes) to the top of your sketch. You can also add it by selecting the "sketch" menu, and choosing "Import Library->XBee". 60 | 61 | ## Learning/Books 62 | Check out these books to learn more about Arduino and XBee: 63 | 64 | * [Building Wireless Sensor Networks Using Arduino](http://www.amazon.com/gp/product/1784395587/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1784395587&linkCode=as2&tag=xbapra-20&linkId=CEH23GT6ZPOT4ZH4) (Kindle version available) 65 | * [Wireless Sensor Networks: with ZigBee, XBee, Arduino, and Processing](http://www.amazon.com/gp/product/0596807732?ie=UTF8&tag=xbapra-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=0596807732Building) (Kindle version available) 66 | * Programming Arduino Getting Started with Sketches 67 | * Making Things Talk 68 | * Getting Started with Arduino (Make: Projects (Available in Kindle) 69 | * Arduino Cookbook (Oreilly Cookbooks) (Available in Kindle) 70 | 71 | ## Hardware 72 | 73 | For development and general tinkering I highly recommend using an Arduino that has 2 serial ports, such as the Arduino Leonardo. The reason is the XBee requires serial port access and it is useful to have another serial port available for debugging via the Arduino serial console. 74 | 75 | * Arduino Leonardo (recommended) 76 | * Arduino UNO R3 (single serial port) 77 | * Arduino Pro (single serial port) 78 | 79 | XBee radios come in two models: Series 1 (S1) and Series 2 (S2). Series 1 are the best choice for most people as they are the easiest to configure. Series 2 XBee radios feature ZigBee and require a firmware update to use this software. Series 1 and 2 are not compatible with each other. 80 | 81 | * XBee Series 1 82 | * XBee Series 2 (ZigBee) 83 | 84 | The Arduino XBee Shield is the easiest option for connecting the XBee to an Arduino. You can find XBee Shields from several vendors and even on ebay. Keep in mind if you select the SparkFun XBee Shield, it requires soldering headers (not included) to connect to an Arduino board. 85 | 86 | If not using an XBee shield you'll need a 3.3V regulator and logic shifting to convert from 5V (Arduino) to 3.3V (XBee). The Arduino is 3.3V tolerant. 87 | 88 | An XBee Explorer is highly recommended for updating firmware and configuring the radio. This is also useful for interfacing an XBee with a computer. If you are using Series 2 radios you'll need an XBee Explorer to upload API firmware to the radio, via X-CTU (they ship with AT firmware). 89 | 90 | 91 | ## Installation 92 | Arduino 1.5 and later 93 | 94 | Arduino now includes a library manager for easier library installation. From the Sketch menu select include library->Manage Libraries, then type "xbee" in the filter and install. 95 | 96 | Prior to Arduino 1.5 installation is a manual 97 | 98 | Download a .zip or .tar.gz release from github. Determine the location of your sketchbook by selecting "preferences" on the Arduino menu. Create a "libraries" folder in your sketchbook and unzip the release file in that location. 99 | 100 | ## Uploading Sketches 101 | 102 | Uploading sketches with a Leonardo is as simple as connecting the Arduino to your computer and uploading. When using a single serial port Arduino, such as the UNO, the jumpers on the XBee Shield must be set to USB. Then, after upload, set back to the XBee position for the XBee to have access to the serial port. Always remember to power off the Arduino before moving the jumpers. 103 | 104 | ## Configuration 105 | 106 | To use this library your XBee must be configured in API mode (AP=2). Take a look at this for information on configuring your radios to form a network. 107 | 108 | ## Questions/Feedback 109 | 110 | Questions about this project should be posted to http://groups.google.com/group/xbee-api?pli=1 Be sure to provide as much detail as possible (e.g. what radios s1 or s2, firmware versions, configuration and code). 111 | 112 | ## Consulting/Commercial Licenses 113 | 114 | I'm available for consulting to assist businesses or entrepreneurs that need help getting their projects up and running. I can also provide a commercial license for situations where you need to distribute code to clients/third parties that would otherwise conflict with GPL. For these matters I can be contacted at andrew.rapp [at] gmail. 115 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | /.DS_Store 2 | -------------------------------------------------------------------------------- /docs/api/annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Class List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
Class List
48 |
49 |
50 |
Here are the classes, structs, unions and interfaces with brief descriptions:
51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
 CAtCommandRequestRepresents an AT Command TX packet The command is used to configure the serially connected XBee radio
 CAtCommandResponseRepresents an AT Command RX packet
 CFrameIdResponseThis class is extended by all Responses that include a frame id
 CModemStatusResponseRepresents a Modem Status RX packet
 CPayloadRequestAll TX packets that support payloads extend this class
 CRemoteAtCommandRequestRepresents an Remote AT Command TX packet The command is used to configure a remote XBee radio
 CRemoteAtCommandResponseRepresents a Remote AT Command RX packet
 CRx16IoSampleResponse
 CRx16ResponseRepresents a Series 1 16-bit address RX packet
 CRx64IoSampleResponse
 CRx64ResponseRepresents a Series 1 64-bit address RX packet
 CRxDataResponseCommon functionality for both Series 1 and 2 data RX data packets
 CRxIoSampleBaseResponseRepresents a Series 1 RX I/O Sample packet
 CRxResponseRepresents a Series 1 RX packet
 CTx16RequestRepresents a Series 1 TX packet that corresponds to Api Id: TX_16_REQUEST Be careful not to send a data array larger than the max packet size of your radio
 CTx64RequestRepresents a Series 1 TX packet that corresponds to Api Id: TX_64_REQUEST
 CTxStatusResponseRepresents a Series 1 TX Status packet
 CXBeePrimary interface for communicating with an XBee Radio
 CXBeeAddress
 CXBeeAddress64Represents a 64-bit XBee Address
 CXBeeRequestSuper class of all XBee requests (TX packets) Users should never create an instance of this class; instead use an subclass of this class It is recommended to reuse Subclasses of the class to conserve memory This class allocates a buffer to
 CXBeeResponseThe super class of all XBee responses (RX packets) Users should never attempt to create an instance of this class; instead create an instance of a subclass It is recommend to reuse subclasses to conserve memory
 CZBRxIoSampleResponseRepresents a Series 2 RX I/O Sample packet
 CZBRxResponseRepresents a Series 2 RX packet
 CZBTxRequestRepresents a Series 2 TX packet that corresponds to Api Id: ZB_TX_REQUEST
 CZBTxStatusResponseRepresents a Series 2 TX status packet
79 |
80 |
81 | 82 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /docs/api/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/bc_s.png -------------------------------------------------------------------------------- /docs/api/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/bdwn.png -------------------------------------------------------------------------------- /docs/api/class_at_command_request-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
AtCommandRequest Member List
48 |
49 |
50 | 51 |

This is the complete list of members for AtCommandRequest, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
AtCommandRequest() (defined in AtCommandRequest)AtCommandRequest
AtCommandRequest(uint8_t *command) (defined in AtCommandRequest)AtCommandRequest
AtCommandRequest(uint8_t *command, uint8_t *commandValue, uint8_t commandValueLength) (defined in AtCommandRequest)AtCommandRequest
clearCommandValue()AtCommandRequest
getApiId()XBeeRequest
getCommand() (defined in AtCommandRequest)AtCommandRequest
getCommandValue() (defined in AtCommandRequest)AtCommandRequest
getCommandValueLength() (defined in AtCommandRequest)AtCommandRequest
getFrameData(uint8_t pos)AtCommandRequestvirtual
getFrameDataLength()AtCommandRequestvirtual
getFrameId()XBeeRequest
setApiId(uint8_t apiId) (defined in XBeeRequest)XBeeRequestprotected
setCommand(uint8_t *command) (defined in AtCommandRequest)AtCommandRequest
setCommandValue(uint8_t *command) (defined in AtCommandRequest)AtCommandRequest
setCommandValueLength(uint8_t length) (defined in AtCommandRequest)AtCommandRequest
setFrameId(uint8_t frameId)XBeeRequest
XBeeRequest(uint8_t apiId, uint8_t frameId)XBeeRequest
71 | 72 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /docs/api/class_at_command_request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_at_command_request.png -------------------------------------------------------------------------------- /docs/api/class_at_command_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_at_command_response.png -------------------------------------------------------------------------------- /docs/api/class_frame_id_response-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
FrameIdResponse Member List
48 |
49 |
50 | 51 |

This is the complete list of members for FrameIdResponse, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 |
_frameDataPtr (defined in XBeeResponse)XBeeResponseprotected
FrameIdResponse() (defined in FrameIdResponse)FrameIdResponse
getApiId()XBeeResponse
getAtCommandResponse(XBeeResponse &responses)XBeeResponse
getChecksum()XBeeResponse
getErrorCode()XBeeResponse
getFrameData()XBeeResponse
getFrameDataLength()XBeeResponse
getFrameId() (defined in FrameIdResponse)FrameIdResponse
getLsbLength()XBeeResponse
getModemStatusResponse(XBeeResponse &response)XBeeResponse
getMsbLength()XBeeResponse
getPacketLength()XBeeResponse
getRemoteAtCommandResponse(XBeeResponse &response)XBeeResponse
getRx16IoSampleResponse(XBeeResponse &response)XBeeResponse
getRx16Response(XBeeResponse &response)XBeeResponse
getRx64IoSampleResponse(XBeeResponse &response)XBeeResponse
getRx64Response(XBeeResponse &response)XBeeResponse
getTxStatusResponse(XBeeResponse &response)XBeeResponse
getZBRxIoSampleResponse(XBeeResponse &response)XBeeResponse
getZBRxResponse(XBeeResponse &response)XBeeResponse
getZBTxStatusResponse(XBeeResponse &response)XBeeResponse
init()XBeeResponse
isAvailable()XBeeResponse
isError()XBeeResponse
reset()XBeeResponse
setApiId(uint8_t apiId) (defined in XBeeResponse)XBeeResponse
setAvailable(bool complete) (defined in XBeeResponse)XBeeResponse
setChecksum(uint8_t checksum) (defined in XBeeResponse)XBeeResponse
setErrorCode(uint8_t errorCode) (defined in XBeeResponse)XBeeResponse
setFrameData(uint8_t *frameDataPtr) (defined in XBeeResponse)XBeeResponse
setFrameLength(uint8_t frameLength) (defined in XBeeResponse)XBeeResponse
setLsbLength(uint8_t lsbLength) (defined in XBeeResponse)XBeeResponse
setMsbLength(uint8_t msbLength) (defined in XBeeResponse)XBeeResponse
XBeeResponse()XBeeResponse
89 | 90 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /docs/api/class_frame_id_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_frame_id_response.png -------------------------------------------------------------------------------- /docs/api/class_modem_status_response-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
ModemStatusResponse Member List
48 |
49 |
50 | 51 |

This is the complete list of members for ModemStatusResponse, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 |
_frameDataPtr (defined in XBeeResponse)XBeeResponseprotected
getApiId()XBeeResponse
getAtCommandResponse(XBeeResponse &responses)XBeeResponse
getChecksum()XBeeResponse
getErrorCode()XBeeResponse
getFrameData()XBeeResponse
getFrameDataLength()XBeeResponse
getLsbLength()XBeeResponse
getModemStatusResponse(XBeeResponse &response)XBeeResponse
getMsbLength()XBeeResponse
getPacketLength()XBeeResponse
getRemoteAtCommandResponse(XBeeResponse &response)XBeeResponse
getRx16IoSampleResponse(XBeeResponse &response)XBeeResponse
getRx16Response(XBeeResponse &response)XBeeResponse
getRx64IoSampleResponse(XBeeResponse &response)XBeeResponse
getRx64Response(XBeeResponse &response)XBeeResponse
getStatus() (defined in ModemStatusResponse)ModemStatusResponse
getTxStatusResponse(XBeeResponse &response)XBeeResponse
getZBRxIoSampleResponse(XBeeResponse &response)XBeeResponse
getZBRxResponse(XBeeResponse &response)XBeeResponse
getZBTxStatusResponse(XBeeResponse &response)XBeeResponse
init()XBeeResponse
isAvailable()XBeeResponse
isError()XBeeResponse
ModemStatusResponse() (defined in ModemStatusResponse)ModemStatusResponse
reset()XBeeResponse
setApiId(uint8_t apiId) (defined in XBeeResponse)XBeeResponse
setAvailable(bool complete) (defined in XBeeResponse)XBeeResponse
setChecksum(uint8_t checksum) (defined in XBeeResponse)XBeeResponse
setErrorCode(uint8_t errorCode) (defined in XBeeResponse)XBeeResponse
setFrameData(uint8_t *frameDataPtr) (defined in XBeeResponse)XBeeResponse
setFrameLength(uint8_t frameLength) (defined in XBeeResponse)XBeeResponse
setLsbLength(uint8_t lsbLength) (defined in XBeeResponse)XBeeResponse
setMsbLength(uint8_t msbLength) (defined in XBeeResponse)XBeeResponse
XBeeResponse()XBeeResponse
89 | 90 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /docs/api/class_modem_status_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_modem_status_response.png -------------------------------------------------------------------------------- /docs/api/class_payload_request-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
PayloadRequest Member List
48 |
49 |
50 | 51 |

This is the complete list of members for PayloadRequest, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |
getApiId()XBeeRequest
getFrameData(uint8_t pos)=0XBeeRequestpure virtual
getFrameDataLength()=0XBeeRequestpure virtual
getFrameId()XBeeRequest
getPayload()PayloadRequest
getPayloadLength()PayloadRequest
PayloadRequest(uint8_t apiId, uint8_t frameId, uint8_t *payload, uint8_t payloadLength) (defined in PayloadRequest)PayloadRequest
setApiId(uint8_t apiId) (defined in XBeeRequest)XBeeRequestprotected
setFrameId(uint8_t frameId)XBeeRequest
setPayload(uint8_t *payloadPtr)PayloadRequest
setPayloadLength(uint8_t payloadLength)PayloadRequest
XBeeRequest(uint8_t apiId, uint8_t frameId)XBeeRequest
66 | 67 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/api/class_payload_request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_payload_request.png -------------------------------------------------------------------------------- /docs/api/class_remote_at_command_request-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
RemoteAtCommandRequest Member List
48 |
49 |
50 | 51 |

This is the complete list of members for RemoteAtCommandRequest, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 |
AtCommandRequest() (defined in AtCommandRequest)AtCommandRequest
AtCommandRequest(uint8_t *command) (defined in AtCommandRequest)AtCommandRequest
AtCommandRequest(uint8_t *command, uint8_t *commandValue, uint8_t commandValueLength) (defined in AtCommandRequest)AtCommandRequest
broadcastAddress64 (defined in RemoteAtCommandRequest)RemoteAtCommandRequeststatic
clearCommandValue()AtCommandRequest
getApiId()XBeeRequest
getApplyChanges() (defined in RemoteAtCommandRequest)RemoteAtCommandRequest
getCommand() (defined in AtCommandRequest)AtCommandRequest
getCommandValue() (defined in AtCommandRequest)AtCommandRequest
getCommandValueLength() (defined in AtCommandRequest)AtCommandRequest
getFrameData(uint8_t pos)RemoteAtCommandRequestvirtual
getFrameDataLength()RemoteAtCommandRequestvirtual
getFrameId()XBeeRequest
getRemoteAddress16() (defined in RemoteAtCommandRequest)RemoteAtCommandRequest
getRemoteAddress64() (defined in RemoteAtCommandRequest)RemoteAtCommandRequest
RemoteAtCommandRequest() (defined in RemoteAtCommandRequest)RemoteAtCommandRequest
RemoteAtCommandRequest(uint16_t remoteAddress16, uint8_t *command, uint8_t *commandValue, uint8_t commandValueLength)RemoteAtCommandRequest
RemoteAtCommandRequest(uint16_t remoteAddress16, uint8_t *command)RemoteAtCommandRequest
RemoteAtCommandRequest(XBeeAddress64 &remoteAddress64, uint8_t *command, uint8_t *commandValue, uint8_t commandValueLength)RemoteAtCommandRequest
RemoteAtCommandRequest(XBeeAddress64 &remoteAddress64, uint8_t *command)RemoteAtCommandRequest
setApiId(uint8_t apiId) (defined in XBeeRequest)XBeeRequestprotected
setApplyChanges(bool applyChanges) (defined in RemoteAtCommandRequest)RemoteAtCommandRequest
setCommand(uint8_t *command) (defined in AtCommandRequest)AtCommandRequest
setCommandValue(uint8_t *command) (defined in AtCommandRequest)AtCommandRequest
setCommandValueLength(uint8_t length) (defined in AtCommandRequest)AtCommandRequest
setFrameId(uint8_t frameId)XBeeRequest
setRemoteAddress16(uint16_t remoteAddress16) (defined in RemoteAtCommandRequest)RemoteAtCommandRequest
setRemoteAddress64(XBeeAddress64 &remoteAddress64) (defined in RemoteAtCommandRequest)RemoteAtCommandRequest
XBeeRequest(uint8_t apiId, uint8_t frameId)XBeeRequest
83 | 84 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /docs/api/class_remote_at_command_request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_remote_at_command_request.png -------------------------------------------------------------------------------- /docs/api/class_remote_at_command_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_remote_at_command_response.png -------------------------------------------------------------------------------- /docs/api/class_rx16_io_sample_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_rx16_io_sample_response.png -------------------------------------------------------------------------------- /docs/api/class_rx16_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_rx16_response.png -------------------------------------------------------------------------------- /docs/api/class_rx64_io_sample_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_rx64_io_sample_response.png -------------------------------------------------------------------------------- /docs/api/class_rx64_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_rx64_response.png -------------------------------------------------------------------------------- /docs/api/class_rx_data_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_rx_data_response.png -------------------------------------------------------------------------------- /docs/api/class_rx_io_sample_base_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_rx_io_sample_base_response.png -------------------------------------------------------------------------------- /docs/api/class_rx_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_rx_response.png -------------------------------------------------------------------------------- /docs/api/class_tx16_request-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
Tx16Request Member List
48 |
49 |
50 | 51 |

This is the complete list of members for Tx16Request, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 |
getAddress16() (defined in Tx16Request)Tx16Request
getApiId()XBeeRequest
getFrameData(uint8_t pos)Tx16Requestvirtual
getFrameDataLength()Tx16Requestvirtual
getFrameId()XBeeRequest
getOption() (defined in Tx16Request)Tx16Request
getPayload()PayloadRequest
getPayloadLength()PayloadRequest
PayloadRequest(uint8_t apiId, uint8_t frameId, uint8_t *payload, uint8_t payloadLength) (defined in PayloadRequest)PayloadRequest
setAddress16(uint16_t addr16) (defined in Tx16Request)Tx16Request
setApiId(uint8_t apiId) (defined in XBeeRequest)XBeeRequestprotected
setFrameId(uint8_t frameId)XBeeRequest
setOption(uint8_t option) (defined in Tx16Request)Tx16Request
setPayload(uint8_t *payloadPtr)PayloadRequest
setPayloadLength(uint8_t payloadLength)PayloadRequest
Tx16Request(uint16_t addr16, uint8_t option, uint8_t *payload, uint8_t payloadLength, uint8_t frameId) (defined in Tx16Request)Tx16Request
Tx16Request(uint16_t addr16, uint8_t *payload, uint8_t payloadLength)Tx16Request
Tx16Request()Tx16Request
XBeeRequest(uint8_t apiId, uint8_t frameId)XBeeRequest
73 | 74 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/api/class_tx16_request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_tx16_request.png -------------------------------------------------------------------------------- /docs/api/class_tx64_request-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
Tx64Request Member List
48 |
49 |
50 | 51 |

This is the complete list of members for Tx64Request, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 |
getAddress64() (defined in Tx64Request)Tx64Request
getApiId()XBeeRequest
getFrameData(uint8_t pos)Tx64Requestvirtual
getFrameDataLength()Tx64Requestvirtual
getFrameId()XBeeRequest
getOption() (defined in Tx64Request)Tx64Request
getPayload()PayloadRequest
getPayloadLength()PayloadRequest
PayloadRequest(uint8_t apiId, uint8_t frameId, uint8_t *payload, uint8_t payloadLength) (defined in PayloadRequest)PayloadRequest
setAddress64(XBeeAddress64 &addr64) (defined in Tx64Request)Tx64Request
setApiId(uint8_t apiId) (defined in XBeeRequest)XBeeRequestprotected
setFrameId(uint8_t frameId)XBeeRequest
setOption(uint8_t option) (defined in Tx64Request)Tx64Request
setPayload(uint8_t *payloadPtr)PayloadRequest
setPayloadLength(uint8_t payloadLength)PayloadRequest
Tx64Request(XBeeAddress64 &addr64, uint8_t option, uint8_t *payload, uint8_t payloadLength, uint8_t frameId) (defined in Tx64Request)Tx64Request
Tx64Request(XBeeAddress64 &addr64, uint8_t *payload, uint8_t payloadLength)Tx64Request
Tx64Request()Tx64Request
XBeeRequest(uint8_t apiId, uint8_t frameId)XBeeRequest
73 | 74 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/api/class_tx64_request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_tx64_request.png -------------------------------------------------------------------------------- /docs/api/class_tx_status_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_tx_status_response.png -------------------------------------------------------------------------------- /docs/api/class_x_bee-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
XBee Member List
48 |
49 |
50 | 51 |

This is the complete list of members for XBee, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
begin(Stream &serial)XBee
getNextFrameId()XBee
getResponse(XBeeResponse &response) (defined in XBee)XBee
getResponse()XBee
readPacket()XBee
readPacket(int timeout)XBee
readPacketUntilAvailable()XBee
send(XBeeRequest &request)XBee
setSerial(Stream &serial)XBee
XBee() (defined in XBee)XBee
64 | 65 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /docs/api/class_x_bee_address-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
XBeeAddress Member List
48 |
49 |
50 | 51 |

This is the complete list of members for XBeeAddress, including all inherited members.

52 | 53 | 54 |
XBeeAddress() (defined in XBeeAddress)XBeeAddress
55 | 56 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /docs/api/class_x_bee_address.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: XBeeAddress Class Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 | 48 |
49 |
XBeeAddress Class Reference
50 |
51 |
52 |
53 | Inheritance diagram for XBeeAddress:
54 |
55 |
56 | 57 | 58 | XBeeAddress64 59 | 60 |
61 |
The documentation for this class was generated from the following files:
    62 |
  • XBee.h
  • 63 |
  • XBee.cpp
  • 64 |
65 |
66 | 67 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/api/class_x_bee_address.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_x_bee_address.png -------------------------------------------------------------------------------- /docs/api/class_x_bee_address64-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
XBeeAddress64 Member List
48 |
49 |
50 | 51 |

This is the complete list of members for XBeeAddress64, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
getLsb() (defined in XBeeAddress64)XBeeAddress64
getMsb() (defined in XBeeAddress64)XBeeAddress64
setLsb(uint32_t lsb) (defined in XBeeAddress64)XBeeAddress64
setMsb(uint32_t msb) (defined in XBeeAddress64)XBeeAddress64
XBeeAddress() (defined in XBeeAddress)XBeeAddress
XBeeAddress64(uint32_t msb, uint32_t lsb) (defined in XBeeAddress64)XBeeAddress64
XBeeAddress64() (defined in XBeeAddress64)XBeeAddress64
61 | 62 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/api/class_x_bee_address64.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: XBeeAddress64 Class Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 | 49 |
50 |
XBeeAddress64 Class Reference
51 |
52 |
53 | 54 |

Represents a 64-bit XBee Address. 55 | More...

56 | 57 |

#include <XBee.h>

58 |
59 | Inheritance diagram for XBeeAddress64:
60 |
61 |
62 | 63 | 64 | XBeeAddress 65 | 66 |
67 | 68 | 70 | 72 | 73 | 75 | 76 | 78 | 79 | 81 | 82 | 84 | 85 |

69 | Public Member Functions

71 |  XBeeAddress64 (uint32_t msb, uint32_t lsb)
 
74 | uint32_t getMsb ()
 
77 | uint32_t getLsb ()
 
80 | void setMsb (uint32_t msb)
 
83 | void setLsb (uint32_t lsb)
 
86 |

Detailed Description

87 |

Represents a 64-bit XBee Address.

88 |

The documentation for this class was generated from the following files:
    89 |
  • XBee.h
  • 90 |
  • XBee.cpp
  • 91 |
92 |
93 | 94 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /docs/api/class_x_bee_address64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_x_bee_address64.png -------------------------------------------------------------------------------- /docs/api/class_x_bee_request-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
XBeeRequest Member List
48 |
49 |
50 | 51 |

This is the complete list of members for XBeeRequest, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
getApiId()XBeeRequest
getFrameData(uint8_t pos)=0XBeeRequestpure virtual
getFrameDataLength()=0XBeeRequestpure virtual
getFrameId()XBeeRequest
setApiId(uint8_t apiId) (defined in XBeeRequest)XBeeRequestprotected
setFrameId(uint8_t frameId)XBeeRequest
XBeeRequest(uint8_t apiId, uint8_t frameId)XBeeRequest
61 | 62 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/api/class_x_bee_request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_x_bee_request.png -------------------------------------------------------------------------------- /docs/api/class_x_bee_response-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
XBeeResponse Member List
48 |
49 |
50 | 51 |

This is the complete list of members for XBeeResponse, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
_frameDataPtr (defined in XBeeResponse)XBeeResponseprotected
getApiId()XBeeResponse
getAtCommandResponse(XBeeResponse &responses)XBeeResponse
getChecksum()XBeeResponse
getErrorCode()XBeeResponse
getFrameData()XBeeResponse
getFrameDataLength()XBeeResponse
getLsbLength()XBeeResponse
getModemStatusResponse(XBeeResponse &response)XBeeResponse
getMsbLength()XBeeResponse
getPacketLength()XBeeResponse
getRemoteAtCommandResponse(XBeeResponse &response)XBeeResponse
getRx16IoSampleResponse(XBeeResponse &response)XBeeResponse
getRx16Response(XBeeResponse &response)XBeeResponse
getRx64IoSampleResponse(XBeeResponse &response)XBeeResponse
getRx64Response(XBeeResponse &response)XBeeResponse
getTxStatusResponse(XBeeResponse &response)XBeeResponse
getZBRxIoSampleResponse(XBeeResponse &response)XBeeResponse
getZBRxResponse(XBeeResponse &response)XBeeResponse
getZBTxStatusResponse(XBeeResponse &response)XBeeResponse
init()XBeeResponse
isAvailable()XBeeResponse
isError()XBeeResponse
reset()XBeeResponse
setApiId(uint8_t apiId) (defined in XBeeResponse)XBeeResponse
setAvailable(bool complete) (defined in XBeeResponse)XBeeResponse
setChecksum(uint8_t checksum) (defined in XBeeResponse)XBeeResponse
setErrorCode(uint8_t errorCode) (defined in XBeeResponse)XBeeResponse
setFrameData(uint8_t *frameDataPtr) (defined in XBeeResponse)XBeeResponse
setFrameLength(uint8_t frameLength) (defined in XBeeResponse)XBeeResponse
setLsbLength(uint8_t lsbLength) (defined in XBeeResponse)XBeeResponse
setMsbLength(uint8_t msbLength) (defined in XBeeResponse)XBeeResponse
XBeeResponse()XBeeResponse
87 | 88 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/api/class_x_bee_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_x_bee_response.png -------------------------------------------------------------------------------- /docs/api/class_z_b_rx_io_sample_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_z_b_rx_io_sample_response.png -------------------------------------------------------------------------------- /docs/api/class_z_b_rx_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_z_b_rx_response.png -------------------------------------------------------------------------------- /docs/api/class_z_b_tx_request-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
ZBTxRequest Member List
48 |
49 |
50 | 51 |

This is the complete list of members for ZBTxRequest, including all inherited members.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 |
getAddress16() (defined in ZBTxRequest)ZBTxRequest
getAddress64() (defined in ZBTxRequest)ZBTxRequest
getApiId()XBeeRequest
getBroadcastRadius() (defined in ZBTxRequest)ZBTxRequest
getFrameData(uint8_t pos)ZBTxRequestprotectedvirtual
getFrameDataLength()ZBTxRequestprotectedvirtual
getFrameId()XBeeRequest
getOption() (defined in ZBTxRequest)ZBTxRequest
getPayload()PayloadRequest
getPayloadLength()PayloadRequest
PayloadRequest(uint8_t apiId, uint8_t frameId, uint8_t *payload, uint8_t payloadLength) (defined in PayloadRequest)PayloadRequest
setAddress16(uint16_t addr16) (defined in ZBTxRequest)ZBTxRequest
setAddress64(XBeeAddress64 &addr64) (defined in ZBTxRequest)ZBTxRequest
setApiId(uint8_t apiId) (defined in XBeeRequest)XBeeRequestprotected
setBroadcastRadius(uint8_t broadcastRadius) (defined in ZBTxRequest)ZBTxRequest
setFrameId(uint8_t frameId)XBeeRequest
setOption(uint8_t option) (defined in ZBTxRequest)ZBTxRequest
setPayload(uint8_t *payloadPtr)PayloadRequest
setPayloadLength(uint8_t payloadLength)PayloadRequest
XBeeRequest(uint8_t apiId, uint8_t frameId)XBeeRequest
ZBTxRequest(XBeeAddress64 &addr64, uint8_t *payload, uint8_t payloadLength)ZBTxRequest
ZBTxRequest(XBeeAddress64 &addr64, uint16_t addr16, uint8_t broadcastRadius, uint8_t option, uint8_t *payload, uint8_t payloadLength, uint8_t frameId) (defined in ZBTxRequest)ZBTxRequest
ZBTxRequest()ZBTxRequest
77 | 78 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/api/class_z_b_tx_request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_z_b_tx_request.png -------------------------------------------------------------------------------- /docs/api/class_z_b_tx_status_response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/class_z_b_tx_status_response.png -------------------------------------------------------------------------------- /docs/api/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Class Index 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 44 |
45 |
46 |
47 |
Class Index
48 |
49 |
50 |
A | F | M | P | R | T | X | Z
51 | 52 | 55 | 57 | 58 | 60 | 62 | 64 | 65 | 67 | 69 | 70 | 71 | 72 |
  A  
53 |
  P  
54 |
Rx64IoSampleResponse   TxStatusResponse   ZBRxResponse   
Rx64Response   
  X  
56 |
ZBTxRequest   
AtCommandRequest   PayloadRequest   RxDataResponse   ZBTxStatusResponse   
AtCommandResponse   
  R  
59 |
RxIoSampleBaseResponse   XBee   
  F  
61 |
RxResponse   XBeeAddress   
RemoteAtCommandRequest   
  T  
63 |
XBeeAddress64   
FrameIdResponse   RemoteAtCommandResponse   XBeeRequest   
  M  
66 |
Rx16IoSampleResponse   Tx16Request   XBeeResponse   
Rx16Response   Tx64Request   
  Z  
68 |
ModemStatusResponse   
ZBRxIoSampleResponse   
73 |
A | F | M | P | R | T | X | Z
74 |
75 | 76 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /docs/api/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/closed.png -------------------------------------------------------------------------------- /docs/api/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/doxygen.png -------------------------------------------------------------------------------- /docs/api/dynsections.js: -------------------------------------------------------------------------------- 1 | function toggleVisibility(linkObj) 2 | { 3 | var base = $(linkObj).attr('id'); 4 | var summary = $('#'+base+'-summary'); 5 | var content = $('#'+base+'-content'); 6 | var trigger = $('#'+base+'-trigger'); 7 | var src=$(trigger).attr('src'); 8 | if (content.is(':visible')===true) { 9 | content.hide(); 10 | summary.show(); 11 | $(linkObj).addClass('closed').removeClass('opened'); 12 | $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); 13 | } else { 14 | content.show(); 15 | summary.hide(); 16 | $(linkObj).removeClass('closed').addClass('opened'); 17 | $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); 18 | } 19 | return false; 20 | } 21 | 22 | function updateStripes() 23 | { 24 | $('table.directory tr'). 25 | removeClass('even').filter(':visible:even').addClass('even'); 26 | } 27 | 28 | function toggleLevel(level) 29 | { 30 | $('table.directory tr').each(function() { 31 | var l = this.id.split('_').length-1; 32 | var i = $('#img'+this.id.substring(3)); 33 | var a = $('#arr'+this.id.substring(3)); 34 | if (l 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: File List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 | 42 |
43 |
44 |
45 |
File List
46 |
47 |
48 |
Here is a list of all documented files with brief descriptions:
49 | 50 | 51 |
 XBee.h
52 |
53 |
54 | 55 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /docs/api/ftv2blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2blank.png -------------------------------------------------------------------------------- /docs/api/ftv2doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2doc.png -------------------------------------------------------------------------------- /docs/api/ftv2folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2folderclosed.png -------------------------------------------------------------------------------- /docs/api/ftv2folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2folderopen.png -------------------------------------------------------------------------------- /docs/api/ftv2lastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2lastnode.png -------------------------------------------------------------------------------- /docs/api/ftv2link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2link.png -------------------------------------------------------------------------------- /docs/api/ftv2mlastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2mlastnode.png -------------------------------------------------------------------------------- /docs/api/ftv2mnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2mnode.png -------------------------------------------------------------------------------- /docs/api/ftv2node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2node.png -------------------------------------------------------------------------------- /docs/api/ftv2plastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2plastnode.png -------------------------------------------------------------------------------- /docs/api/ftv2pnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2pnode.png -------------------------------------------------------------------------------- /docs/api/ftv2splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2splitbar.png -------------------------------------------------------------------------------- /docs/api/ftv2vertline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/ftv2vertline.png -------------------------------------------------------------------------------- /docs/api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | XBee-Arduino: Main Page 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 24 | 25 | 26 |
20 |
XBee-Arduino 21 |  0.2 22 |
23 |
27 |
28 | 29 | 30 | 37 |
38 |
39 |
40 |
XBee-Arduino Documentation
41 |
42 |
43 |
44 | 45 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/api/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/nav_f.png -------------------------------------------------------------------------------- /docs/api/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/nav_g.png -------------------------------------------------------------------------------- /docs/api/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/nav_h.png -------------------------------------------------------------------------------- /docs/api/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/open.png -------------------------------------------------------------------------------- /docs/api/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/sync_off.png -------------------------------------------------------------------------------- /docs/api/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/sync_on.png -------------------------------------------------------------------------------- /docs/api/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/tab_a.png -------------------------------------------------------------------------------- /docs/api/tab_b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/tab_b.gif -------------------------------------------------------------------------------- /docs/api/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/tab_b.png -------------------------------------------------------------------------------- /docs/api/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/tab_h.png -------------------------------------------------------------------------------- /docs/api/tab_l.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/tab_l.gif -------------------------------------------------------------------------------- /docs/api/tab_r.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/tab_r.gif -------------------------------------------------------------------------------- /docs/api/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrapp/xbee-arduino/39f236ea1827fd5fe3ce66ffcc07433ab8ab9197/docs/api/tab_s.png -------------------------------------------------------------------------------- /docs/api/tabs.css: -------------------------------------------------------------------------------- 1 | .tabs, .tabs2, .tabs3 { 2 | background-image: url('tab_b.png'); 3 | width: 100%; 4 | z-index: 101; 5 | font-size: 13px; 6 | font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; 7 | } 8 | 9 | .tabs2 { 10 | font-size: 10px; 11 | } 12 | .tabs3 { 13 | font-size: 9px; 14 | } 15 | 16 | .tablist { 17 | margin: 0; 18 | padding: 0; 19 | display: table; 20 | } 21 | 22 | .tablist li { 23 | float: left; 24 | display: table-cell; 25 | background-image: url('tab_b.png'); 26 | line-height: 36px; 27 | list-style: none; 28 | } 29 | 30 | .tablist a { 31 | display: block; 32 | padding: 0 20px; 33 | font-weight: bold; 34 | background-image:url('tab_s.png'); 35 | background-repeat:no-repeat; 36 | background-position:right; 37 | color: #283A5D; 38 | text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); 39 | text-decoration: none; 40 | outline: none; 41 | } 42 | 43 | .tabs3 .tablist a { 44 | padding: 0 10px; 45 | } 46 | 47 | .tablist a:hover { 48 | background-image: url('tab_h.png'); 49 | background-repeat:repeat-x; 50 | color: #fff; 51 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 52 | text-decoration: none; 53 | } 54 | 55 | .tablist li.current a { 56 | background-image: url('tab_a.png'); 57 | background-repeat:repeat-x; 58 | color: #fff; 59 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 60 | } 61 | -------------------------------------------------------------------------------- /doxygen-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | doxygen Doxyfile 3 | -------------------------------------------------------------------------------- /examples/AtCommand/AtCommand.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | /* 24 | This example is for Series 1 (10C8 or later firmware) or Series 2 XBee radios 25 | Sends a few AT command queries to the radio and checks the status response for success 26 | 27 | This example uses the SoftSerial library to view the XBee communication. I am using a 28 | Modern Device USB BUB board (http://moderndevice.com/connect) and viewing the output 29 | with the Arduino Serial Monitor. 30 | */ 31 | 32 | // Define SoftSerial TX/RX pins 33 | // Connect Arduino pin 8 to TX of usb-serial device 34 | uint8_t ssRX = 8; 35 | // Connect Arduino pin 9 to RX of usb-serial device 36 | uint8_t ssTX = 9; 37 | // Remember to connect all devices to a common Ground: XBee, Arduino and USB-Serial device 38 | SoftwareSerial nss(ssRX, ssTX); 39 | 40 | XBee xbee = XBee(); 41 | 42 | // serial high 43 | uint8_t shCmd[] = {'S','H'}; 44 | // serial low 45 | uint8_t slCmd[] = {'S','L'}; 46 | // association status 47 | uint8_t assocCmd[] = {'A','I'}; 48 | 49 | AtCommandRequest atRequest = AtCommandRequest(shCmd); 50 | 51 | AtCommandResponse atResponse = AtCommandResponse(); 52 | 53 | void setup() { 54 | Serial.begin(9600); 55 | xbee.begin(Serial); 56 | // start soft serial 57 | nss.begin(9600); 58 | 59 | // Startup delay to wait for XBee radio to initialize. 60 | // you may need to increase this value if you are not getting a response 61 | delay(5000); 62 | } 63 | 64 | void loop() { 65 | 66 | // get SH 67 | sendAtCommand(); 68 | 69 | // set command to SL 70 | atRequest.setCommand(slCmd); 71 | sendAtCommand(); 72 | 73 | // set command to AI 74 | atRequest.setCommand(assocCmd); 75 | sendAtCommand(); 76 | 77 | // we're done. Hit the Arduino reset button to start the sketch over 78 | while (1) {}; 79 | } 80 | 81 | void sendAtCommand() { 82 | nss.println("Sending command to the XBee"); 83 | 84 | // send the command 85 | xbee.send(atRequest); 86 | 87 | // wait up to 5 seconds for the status response 88 | if (xbee.readPacket(5000)) { 89 | // got a response! 90 | 91 | // should be an AT command response 92 | if (xbee.getResponse().getApiId() == AT_COMMAND_RESPONSE) { 93 | xbee.getResponse().getAtCommandResponse(atResponse); 94 | 95 | if (atResponse.isOk()) { 96 | nss.print("Command ["); 97 | nss.print(atResponse.getCommand()[0]); 98 | nss.print(atResponse.getCommand()[1]); 99 | nss.println("] was successful!"); 100 | 101 | if (atResponse.getValueLength() > 0) { 102 | nss.print("Command value length is "); 103 | nss.println(atResponse.getValueLength(), DEC); 104 | 105 | nss.print("Command value: "); 106 | 107 | for (int i = 0; i < atResponse.getValueLength(); i++) { 108 | nss.print(atResponse.getValue()[i], HEX); 109 | nss.print(" "); 110 | } 111 | 112 | nss.println(""); 113 | } 114 | } 115 | else { 116 | nss.print("Command return error code: "); 117 | nss.println(atResponse.getStatus(), HEX); 118 | } 119 | } else { 120 | nss.print("Expected AT response but got "); 121 | nss.print(xbee.getResponse().getApiId(), HEX); 122 | } 123 | } else { 124 | // at command failed 125 | if (xbee.getResponse().isError()) { 126 | nss.print("Error reading packet. Error code: "); 127 | nss.println(xbee.getResponse().getErrorCode()); 128 | } 129 | else { 130 | nss.print("No response from radio"); 131 | } 132 | } 133 | } 134 | 135 | 136 | -------------------------------------------------------------------------------- /examples/Echo_Callbacks/Echo_Callbacks.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015 Matthijs Kooijman 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | /* 24 | This example is for Series 1 and 2 XBee (no changes needed for either). 25 | 26 | It listens for incoming packets and echoes back any data received back 27 | to the sender. This example shows how to use XBeeWithCallbacks to 28 | concisely express reading of response packets. 29 | 30 | This example assumes an Arduino with two serial ports (like the 31 | Leonardo or Mega). Replace Serial and Serial1 below appropriately for 32 | your hardware. 33 | */ 34 | 35 | // create the XBee object 36 | XBeeWithCallbacks xbee; 37 | 38 | void zbReceive(ZBRxResponse& rx, uintptr_t) { 39 | // Create a reply packet containing the same data 40 | // This directly reuses the rx data array, which is ok since the tx 41 | // packet is sent before any new response is received 42 | ZBTxRequest tx; 43 | tx.setAddress64(rx.getRemoteAddress64()); 44 | tx.setAddress16(rx.getRemoteAddress16()); 45 | tx.setPayload(rx.getFrameData() + rx.getDataOffset(), rx.getDataLength()); 46 | 47 | // Send the reply, but do not wait for the tx status reply. If an 48 | // error occurs, the global onTxStatusResponse handler will print an 49 | // error message, but no message is printed on succes. 50 | xbee.send(tx); 51 | Serial.println(F("Sending ZBTxRequest")); 52 | } 53 | 54 | void receive16(Rx16Response& rx, uintptr_t) { 55 | // Create a reply packet containing the same data 56 | // This directly reuses the rx data array, which is ok since the tx 57 | // packet is sent before any new response is received 58 | Tx16Request tx; 59 | tx.setAddress16(rx.getRemoteAddress16()); 60 | tx.setPayload(rx.getFrameData() + rx.getDataOffset(), rx.getDataLength()); 61 | 62 | // Send the reply, but do not wait for the tx status reply. If an 63 | // error occurs, the global onTxStatusResponse handler will print an 64 | // error message, but no message is printed on succes. 65 | xbee.send(tx); 66 | Serial.println(F("Sending Tx16Request")); 67 | } 68 | 69 | void receive64(Rx64Response& rx, uintptr_t) { 70 | // Create a reply packet containing the same data 71 | // This directly reuses the rx data array, which is ok since the tx 72 | // packet is sent before any new response is received 73 | Tx64Request tx; 74 | tx.setAddress64(rx.getRemoteAddress64()); 75 | tx.setPayload(rx.getFrameData() + rx.getDataOffset(), rx.getDataLength()); 76 | 77 | // Send the reply, but do not wait for the tx status reply. If an 78 | // error occurs, the global onTxStatusResponse handler will print an 79 | // error message, but no message is printed on succes. 80 | xbee.send(tx); 81 | Serial.println(F("Sending Tx64Request")); 82 | } 83 | void setup() { 84 | Serial.begin(9600); 85 | 86 | Serial1.begin(9600); 87 | xbee.setSerial(Serial1); 88 | 89 | // Make sure that any errors are logged to Serial. The address of 90 | // Serial is first cast to Print*, since that's what the callback 91 | // expects, and then to uintptr_t to fit it inside the data parameter. 92 | xbee.onPacketError(printErrorCb, (uintptr_t)(Print*)&Serial); 93 | xbee.onTxStatusResponse(printErrorCb, (uintptr_t)(Print*)&Serial); 94 | xbee.onZBTxStatusResponse(printErrorCb, (uintptr_t)(Print*)&Serial); 95 | 96 | // These are called when an actual packet received 97 | xbee.onZBRxResponse(zbReceive); 98 | xbee.onRx16Response(receive16); 99 | xbee.onRx64Response(receive64); 100 | 101 | // Print any unhandled response with proper formatting 102 | xbee.onOtherResponse(printResponseCb, (uintptr_t)(Print*)&Serial); 103 | 104 | // Enable this to print the raw bytes for _all_ responses before they 105 | // are handled 106 | //xbee.onResponse(printRawResponseCb, (uintptr_t)(Print*)&Serial); 107 | 108 | // Set AO=0 to make sure we get ZBRxResponses, not 109 | // ZBExplicitRxResponses (only supported on series2). This probably 110 | // isn't needed, but nicely shows how to use sendAndWait(). 111 | uint8_t value = 0; 112 | AtCommandRequest req((uint8_t*)"AO", &value, sizeof(value)); 113 | req.setFrameId(xbee.getNextFrameId()); 114 | // Send the command and wait up to 150ms for a response 115 | uint8_t status = xbee.sendAndWait(req, 150); 116 | if (status == 0) 117 | Serial.println(F("Set AO=0")); 118 | else 119 | Serial.println(F("Failed to set AO (this is expected on series1)")); 120 | } 121 | 122 | void loop() { 123 | // Continuously let xbee read packets and call callbacks. 124 | xbee.loop(); 125 | } 126 | 127 | -------------------------------------------------------------------------------- /examples/RemoteAtCommand/RemoteAtCommand.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | /* 24 | This example is for Series 1 (10C8 or later firmware) or Series 2 XBee 25 | Sends two Remote AT commands to configure the remote radio for I/O line monitoring 26 | 27 | This example uses the SoftSerial library to view the XBee communication. I am using a 28 | Modern Device USB BUB board (http://moderndevice.com/connect) and viewing the output 29 | with the Arduino Serial Monitor. 30 | */ 31 | 32 | // Define SoftSerial TX/RX pins 33 | // Connect Arduino pin 8 to TX of usb-serial device 34 | uint8_t ssRX = 8; 35 | // Connect Arduino pin 9 to RX of usb-serial device 36 | uint8_t ssTX = 9; 37 | // Remember to connect all devices to a common Ground: XBee, Arduino and USB-Serial device 38 | SoftwareSerial nss(ssRX, ssTX); 39 | 40 | XBee xbee = XBee(); 41 | 42 | // Turn on I/O sampling 43 | uint8_t irCmd[] = {'I','R'}; 44 | // Set sample rate to 65 seconds (0xffff/1000) 45 | uint8_t irValue[] = { 0xff, 0xff }; 46 | 47 | // Set DIO0 (pin 20) to Analog Input 48 | uint8_t d0Cmd[] = { 'D', '0' }; 49 | uint8_t d0Value[] = { 0x2 }; 50 | 51 | // SH + SL of your remote radio 52 | XBeeAddress64 remoteAddress = XBeeAddress64(0x0013a200, 0x400a3e02); 53 | // Create a remote AT request with the IR command 54 | RemoteAtCommandRequest remoteAtRequest = RemoteAtCommandRequest(remoteAddress, irCmd, irValue, sizeof(irValue)); 55 | 56 | // Create a Remote AT response object 57 | RemoteAtCommandResponse remoteAtResponse = RemoteAtCommandResponse(); 58 | 59 | void setup() { 60 | Serial.begin(9600); 61 | xbee.begin(Serial); 62 | // start soft serial 63 | nss.begin(9600); 64 | 65 | // When powered on, XBee radios require a few seconds to start up 66 | // and join the network. 67 | // During this time, any packets sent to the radio are ignored. 68 | // Series 2 radios send a modem status packet on startup. 69 | 70 | // it took about 4 seconds for mine to return modem status. 71 | // In my experience, series 1 radios take a bit longer to associate. 72 | // Of course if the radio has been powered on for some time before the sketch runs, 73 | // you can safely remove this delay. 74 | // Or if you both commands are not successful, try increasing the delay. 75 | 76 | delay(5000); 77 | } 78 | 79 | void loop() { 80 | sendRemoteAtCommand(); 81 | 82 | // now reuse same object for DIO0 command 83 | remoteAtRequest.setCommand(d0Cmd); 84 | remoteAtRequest.setCommandValue(d0Value); 85 | remoteAtRequest.setCommandValueLength(sizeof(d0Value)); 86 | 87 | sendRemoteAtCommand(); 88 | 89 | // it's a good idea to clear the set value so that the object can be reused for a query 90 | remoteAtRequest.clearCommandValue(); 91 | 92 | // we're done 93 | while (1) {}; 94 | } 95 | 96 | void sendRemoteAtCommand() { 97 | nss.println("Sending command to the XBee"); 98 | 99 | // send the command 100 | xbee.send(remoteAtRequest); 101 | 102 | // wait up to 5 seconds for the status response 103 | if (xbee.readPacket(5000)) { 104 | // got a response! 105 | 106 | // should be an AT command response 107 | if (xbee.getResponse().getApiId() == REMOTE_AT_COMMAND_RESPONSE) { 108 | xbee.getResponse().getRemoteAtCommandResponse(remoteAtResponse); 109 | 110 | if (remoteAtResponse.isOk()) { 111 | nss.print("Command ["); 112 | nss.print(remoteAtResponse.getCommand()[0]); 113 | nss.print(remoteAtResponse.getCommand()[1]); 114 | nss.println("] was successful!"); 115 | 116 | if (remoteAtResponse.getValueLength() > 0) { 117 | nss.print("Command value length is "); 118 | nss.println(remoteAtResponse.getValueLength(), DEC); 119 | 120 | nss.print("Command value: "); 121 | 122 | for (int i = 0; i < remoteAtResponse.getValueLength(); i++) { 123 | nss.print(remoteAtResponse.getValue()[i], HEX); 124 | nss.print(" "); 125 | } 126 | 127 | nss.println(""); 128 | } 129 | } else { 130 | nss.print("Command returned error code: "); 131 | nss.println(remoteAtResponse.getStatus(), HEX); 132 | } 133 | } else { 134 | nss.print("Expected Remote AT response but got "); 135 | nss.print(xbee.getResponse().getApiId(), HEX); 136 | } 137 | } else if (xbee.getResponse().isError()) { 138 | nss.print("Error reading packet. Error code: "); 139 | nss.println(xbee.getResponse().getErrorCode()); 140 | } else { 141 | nss.print("No response from radio"); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /examples/Series1_IoSamples/Series1_IoSamples.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | /* 24 | This example is for Series 1 XBee Radios only 25 | Receives I/O samples from a remote radio with 16-bit addressing. 26 | The remote radio must have IR > 0, at least one digital or analog input enabled 27 | and DL set to the 16-bit address of the receiving XBee (the one connected to the Arduino). 28 | 29 | This example uses the SoftSerial library to view the XBee communication. I am using a 30 | Modern Device USB BUB board (http://moderndevice.com/connect) and viewing the output 31 | with the Arduino Serial Monitor. 32 | */ 33 | 34 | // Define NewSoftSerial TX/RX pins 35 | // Connect Arduino pin 8 to TX of usb-serial device 36 | uint8_t ssRX = 8; 37 | // Connect Arduino pin 9 to RX of usb-serial device 38 | uint8_t ssTX = 9; 39 | // Remember to connect all devices to a common Ground: XBee, Arduino and USB-Serial device 40 | SoftwareSerial nss(ssRX, ssTX); 41 | 42 | XBee xbee = XBee(); 43 | 44 | Rx16IoSampleResponse ioSample = Rx16IoSampleResponse(); 45 | // 64-bit response is same except api id equals RX_64_IO_RESPONSE and returns a 64-bit address 46 | //Rx64IoSampleResponse ioSample = Rx64IoSampleResponse(); 47 | 48 | void setup() { 49 | Serial.begin(9600); 50 | xbee.setSerial(Serial); 51 | // start soft serial 52 | nss.begin(9600); 53 | } 54 | 55 | void loop() { 56 | //attempt to read a packet 57 | xbee.readPacket(); 58 | 59 | if (xbee.getResponse().isAvailable()) { 60 | // got something 61 | 62 | if (xbee.getResponse().getApiId() == RX_16_IO_RESPONSE) { 63 | xbee.getResponse().getRx16IoSampleResponse(ioSample); 64 | 65 | nss.print("Received I/O Sample from: "); 66 | nss.println(ioSample.getRemoteAddress16(), HEX); 67 | 68 | nss.print("Sample size is "); 69 | nss.println(ioSample.getSampleSize(), DEC); 70 | 71 | if (ioSample.containsAnalog()) { 72 | nss.println("Sample contains analog data"); 73 | } 74 | 75 | if (ioSample.containsDigital()) { 76 | nss.println("Sample contains digtal data"); 77 | } 78 | 79 | for (int k = 0; k < ioSample.getSampleSize(); k++) { 80 | nss.print("Sample "); 81 | nss.print(k + 1, DEC); 82 | nss.println(":"); 83 | 84 | for (int i = 0; i <= 5; i++) { 85 | if (ioSample.isAnalogEnabled(i)) { 86 | nss.print("Analog (AI"); 87 | nss.print(i, DEC); 88 | nss.print(") is "); 89 | nss.println(ioSample.getAnalog(i, k)); 90 | } 91 | } 92 | 93 | for (int i = 0; i <= 8; i++) { 94 | if (ioSample.isDigitalEnabled(i)) { 95 | nss.print("Digtal (DI"); 96 | nss.print(i, DEC); 97 | nss.print(") is "); 98 | nss.println(ioSample.isDigitalOn(i, k)); 99 | } 100 | } 101 | } 102 | } 103 | else { 104 | nss.print("Expected I/O Sample, but got "); 105 | nss.print(xbee.getResponse().getApiId(), HEX); 106 | } 107 | } 108 | else if (xbee.getResponse().isError()) { 109 | nss.print("Error reading packet. Error code: "); 110 | nss.println(xbee.getResponse().getErrorCode()); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /examples/Series1_Rx/Series1_Rx.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | /* 23 | This example is for Series 1 XBee (802.15.4) 24 | Receives either a RX16 or RX64 packet and sets a PWM value based on packet data. 25 | Error led is flashed if an unexpected packet is received 26 | */ 27 | 28 | XBee xbee = XBee(); 29 | XBeeResponse response = XBeeResponse(); 30 | // create reusable response objects for responses we expect to handle 31 | Rx16Response rx16 = Rx16Response(); 32 | Rx64Response rx64 = Rx64Response(); 33 | 34 | int statusLed = 11; 35 | int errorLed = 12; 36 | int dataLed = 10; 37 | 38 | uint8_t option = 0; 39 | uint8_t data = 0; 40 | 41 | void flashLed(int pin, int times, int wait) { 42 | 43 | for (int i = 0; i < times; i++) { 44 | digitalWrite(pin, HIGH); 45 | delay(wait); 46 | digitalWrite(pin, LOW); 47 | 48 | if (i + 1 < times) { 49 | delay(wait); 50 | } 51 | } 52 | } 53 | 54 | void setup() { 55 | pinMode(statusLed, OUTPUT); 56 | pinMode(errorLed, OUTPUT); 57 | pinMode(dataLed, OUTPUT); 58 | 59 | // start serial 60 | Serial.begin(9600); 61 | xbee.setSerial(Serial); 62 | 63 | flashLed(statusLed, 3, 50); 64 | } 65 | 66 | // continuously reads packets, looking for RX16 or RX64 67 | void loop() { 68 | 69 | xbee.readPacket(); 70 | 71 | if (xbee.getResponse().isAvailable()) { 72 | // got something 73 | 74 | if (xbee.getResponse().getApiId() == RX_16_RESPONSE || xbee.getResponse().getApiId() == RX_64_RESPONSE) { 75 | // got a rx packet 76 | 77 | if (xbee.getResponse().getApiId() == RX_16_RESPONSE) { 78 | xbee.getResponse().getRx16Response(rx16); 79 | option = rx16.getOption(); 80 | data = rx16.getData(0); 81 | } else { 82 | xbee.getResponse().getRx64Response(rx64); 83 | option = rx64.getOption(); 84 | data = rx64.getData(0); 85 | } 86 | 87 | // TODO check option, rssi bytes 88 | flashLed(statusLed, 1, 10); 89 | 90 | // set dataLed PWM to value of the first byte in the data 91 | analogWrite(dataLed, data); 92 | } else { 93 | // not something we were expecting 94 | flashLed(errorLed, 1, 25); 95 | } 96 | } else if (xbee.getResponse().isError()) { 97 | //nss.print("Error reading packet. Error code: "); 98 | //nss.println(xbee.getResponse().getErrorCode()); 99 | // or flash error led 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /examples/Series1_Tx/Series1_Tx.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | /* 23 | This example is for Series 1 XBee 24 | Sends a TX16 or TX64 request with the value of analogRead(pin5) and checks the status response for success 25 | Note: In my testing it took about 15 seconds for the XBee to start reporting success, so I've added a startup delay 26 | */ 27 | 28 | XBee xbee = XBee(); 29 | 30 | unsigned long start = millis(); 31 | 32 | // allocate two bytes for to hold a 10-bit analog reading 33 | uint8_t payload[] = { 0, 0 }; 34 | 35 | // with Series 1 you can use either 16-bit or 64-bit addressing 36 | 37 | // 16-bit addressing: Enter address of remote XBee, typically the coordinator 38 | Tx16Request tx = Tx16Request(0x1874, payload, sizeof(payload)); 39 | 40 | // 64-bit addressing: This is the SH + SL address of remote XBee 41 | //XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x4008b490); 42 | // unless you have MY on the receiving radio set to FFFF, this will be received as a RX16 packet 43 | //Tx64Request tx = Tx64Request(addr64, payload, sizeof(payload)); 44 | 45 | TxStatusResponse txStatus = TxStatusResponse(); 46 | 47 | int pin5 = 0; 48 | 49 | int statusLed = 11; 50 | int errorLed = 12; 51 | 52 | void flashLed(int pin, int times, int wait) { 53 | 54 | for (int i = 0; i < times; i++) { 55 | digitalWrite(pin, HIGH); 56 | delay(wait); 57 | digitalWrite(pin, LOW); 58 | 59 | if (i + 1 < times) { 60 | delay(wait); 61 | } 62 | } 63 | } 64 | 65 | void setup() { 66 | pinMode(statusLed, OUTPUT); 67 | pinMode(errorLed, OUTPUT); 68 | Serial.begin(9600); 69 | xbee.setSerial(Serial); 70 | } 71 | 72 | void loop() { 73 | 74 | // start transmitting after a startup delay. Note: this will rollover to 0 eventually so not best way to handle 75 | if (millis() - start > 15000) { 76 | // break down 10-bit reading into two bytes and place in payload 77 | pin5 = analogRead(5); 78 | payload[0] = pin5 >> 8 & 0xff; 79 | payload[1] = pin5 & 0xff; 80 | 81 | xbee.send(tx); 82 | 83 | // flash TX indicator 84 | flashLed(statusLed, 1, 100); 85 | } 86 | 87 | // after sending a tx request, we expect a status response 88 | // wait up to 5 seconds for the status response 89 | if (xbee.readPacket(5000)) { 90 | // got a response! 91 | 92 | // should be a znet tx status 93 | if (xbee.getResponse().getApiId() == TX_STATUS_RESPONSE) { 94 | xbee.getResponse().getTxStatusResponse(txStatus); 95 | 96 | // get the delivery status, the fifth byte 97 | if (txStatus.getStatus() == SUCCESS) { 98 | // success. time to celebrate 99 | flashLed(statusLed, 5, 50); 100 | } else { 101 | // the remote XBee did not receive our packet. is it powered on? 102 | flashLed(errorLed, 3, 500); 103 | } 104 | } 105 | } else if (xbee.getResponse().isError()) { 106 | //nss.print("Error reading packet. Error code: "); 107 | //nss.println(xbee.getResponse().getErrorCode()); 108 | // or flash error led 109 | } else { 110 | // local XBee did not provide a timely TX Status Response. Radio is not configured properly or connected 111 | flashLed(errorLed, 2, 50); 112 | } 113 | 114 | delay(1000); 115 | } 116 | -------------------------------------------------------------------------------- /examples/Series2_IoSamples/Series2_IoSamples.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | /* 24 | This example is for Series 2 (ZigBee) XBee Radios only 25 | Receives I/O samples from a remote radio. 26 | The remote radio must have IR > 0 and at least one digital or analog input enabled. 27 | The XBee coordinator should be connected to the Arduino. 28 | 29 | This example uses the SoftSerial library to view the XBee communication. I am using a 30 | Modern Device USB BUB board (http://moderndevice.com/connect) and viewing the output 31 | with the Arduino Serial Monitor. 32 | */ 33 | 34 | // Define NewSoftSerial TX/RX pins 35 | // Connect Arduino pin 8 to TX of usb-serial device 36 | uint8_t ssRX = 8; 37 | // Connect Arduino pin 9 to RX of usb-serial device 38 | uint8_t ssTX = 9; 39 | // Remember to connect all devices to a common Ground: XBee, Arduino and USB-Serial device 40 | SoftwareSerial nss(ssRX, ssTX); 41 | 42 | XBee xbee = XBee(); 43 | 44 | ZBRxIoSampleResponse ioSample = ZBRxIoSampleResponse(); 45 | 46 | XBeeAddress64 test = XBeeAddress64(); 47 | 48 | void setup() { 49 | Serial.begin(9600); 50 | xbee.setSerial(Serial); 51 | // start soft serial 52 | nss.begin(9600); 53 | } 54 | 55 | void loop() { 56 | //attempt to read a packet 57 | xbee.readPacket(); 58 | 59 | if (xbee.getResponse().isAvailable()) { 60 | // got something 61 | 62 | if (xbee.getResponse().getApiId() == ZB_IO_SAMPLE_RESPONSE) { 63 | xbee.getResponse().getZBRxIoSampleResponse(ioSample); 64 | 65 | nss.print("Received I/O Sample from: "); 66 | 67 | nss.print(ioSample.getRemoteAddress64().getMsb(), HEX); 68 | nss.print(ioSample.getRemoteAddress64().getLsb(), HEX); 69 | nss.println(""); 70 | 71 | if (ioSample.containsAnalog()) { 72 | nss.println("Sample contains analog data"); 73 | } 74 | 75 | if (ioSample.containsDigital()) { 76 | nss.println("Sample contains digtal data"); 77 | } 78 | 79 | // read analog inputs 80 | for (int i = 0; i <= 4; i++) { 81 | if (ioSample.isAnalogEnabled(i)) { 82 | nss.print("Analog (AI"); 83 | nss.print(i, DEC); 84 | nss.print(") is "); 85 | nss.println(ioSample.getAnalog(i), DEC); 86 | } 87 | } 88 | 89 | // check digital inputs 90 | for (int i = 0; i <= 12; i++) { 91 | if (ioSample.isDigitalEnabled(i)) { 92 | nss.print("Digital (DI"); 93 | nss.print(i, DEC); 94 | nss.print(") is "); 95 | nss.println(ioSample.isDigitalOn(i), DEC); 96 | } 97 | } 98 | 99 | // method for printing the entire frame data 100 | //for (int i = 0; i < xbee.getResponse().getFrameDataLength(); i++) { 101 | // nss.print("byte ["); 102 | // nss.print(i, DEC); 103 | // nss.print("] is "); 104 | // nss.println(xbee.getResponse().getFrameData()[i], HEX); 105 | //} 106 | } 107 | else { 108 | nss.print("Expected I/O Sample, but got "); 109 | nss.print(xbee.getResponse().getApiId(), HEX); 110 | } 111 | } else if (xbee.getResponse().isError()) { 112 | nss.print("Error reading packet. Error code: "); 113 | nss.println(xbee.getResponse().getErrorCode()); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /examples/Series2_Rx/Series2_Rx.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | /* 23 | This example is for Series 2 XBee 24 | Receives a ZB RX packet and sets a PWM value based on packet data. 25 | Error led is flashed if an unexpected packet is received 26 | */ 27 | 28 | XBee xbee = XBee(); 29 | XBeeResponse response = XBeeResponse(); 30 | // create reusable response objects for responses we expect to handle 31 | ZBRxResponse rx = ZBRxResponse(); 32 | ModemStatusResponse msr = ModemStatusResponse(); 33 | 34 | int statusLed = 13; 35 | int errorLed = 13; 36 | int dataLed = 13; 37 | 38 | void flashLed(int pin, int times, int wait) { 39 | 40 | for (int i = 0; i < times; i++) { 41 | digitalWrite(pin, HIGH); 42 | delay(wait); 43 | digitalWrite(pin, LOW); 44 | 45 | if (i + 1 < times) { 46 | delay(wait); 47 | } 48 | } 49 | } 50 | 51 | void setup() { 52 | pinMode(statusLed, OUTPUT); 53 | pinMode(errorLed, OUTPUT); 54 | pinMode(dataLed, OUTPUT); 55 | 56 | // start serial 57 | Serial.begin(9600); 58 | xbee.begin(Serial); 59 | 60 | flashLed(statusLed, 3, 50); 61 | } 62 | 63 | // continuously reads packets, looking for ZB Receive or Modem Status 64 | void loop() { 65 | 66 | xbee.readPacket(); 67 | 68 | if (xbee.getResponse().isAvailable()) { 69 | // got something 70 | 71 | if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) { 72 | // got a zb rx packet 73 | 74 | // now fill our zb rx class 75 | xbee.getResponse().getZBRxResponse(rx); 76 | 77 | if (rx.getOption() == ZB_PACKET_ACKNOWLEDGED) { 78 | // the sender got an ACK 79 | flashLed(statusLed, 10, 10); 80 | } else { 81 | // we got it (obviously) but sender didn't get an ACK 82 | flashLed(errorLed, 2, 20); 83 | } 84 | // set dataLed PWM to value of the first byte in the data 85 | analogWrite(dataLed, rx.getData(0)); 86 | } else if (xbee.getResponse().getApiId() == MODEM_STATUS_RESPONSE) { 87 | xbee.getResponse().getModemStatusResponse(msr); 88 | // the local XBee sends this response on certain events, like association/dissociation 89 | 90 | if (msr.getStatus() == ASSOCIATED) { 91 | // yay this is great. flash led 92 | flashLed(statusLed, 10, 10); 93 | } else if (msr.getStatus() == DISASSOCIATED) { 94 | // this is awful.. flash led to show our discontent 95 | flashLed(errorLed, 10, 10); 96 | } else { 97 | // another status 98 | flashLed(statusLed, 5, 10); 99 | } 100 | } else { 101 | // not something we were expecting 102 | flashLed(errorLed, 1, 25); 103 | } 104 | } else if (xbee.getResponse().isError()) { 105 | //nss.print("Error reading packet. Error code: "); 106 | //nss.println(xbee.getResponse().getErrorCode()); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /examples/Series2_Rx_Nss/Series2_Rx_Nss.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | /* 24 | This example is for Series 2 XBee 25 | Receives a ZB RX packet and prints the packet to softserial 26 | */ 27 | 28 | XBee xbee = XBee(); 29 | XBeeResponse response = XBeeResponse(); 30 | // create reusable response objects for responses we expect to handle 31 | ZBRxResponse rx = ZBRxResponse(); 32 | ModemStatusResponse msr = ModemStatusResponse(); 33 | 34 | // Define NewSoftSerial TX/RX pins 35 | // Connect Arduino pin 8 to TX of usb-serial device 36 | uint8_t ssRX = 8; 37 | // Connect Arduino pin 9 to RX of usb-serial device 38 | uint8_t ssTX = 9; 39 | // Remember to connect all devices to a common Ground: XBee, Arduino and USB-Serial device 40 | SoftwareSerial nss(ssRX, ssTX); 41 | 42 | 43 | void setup() { 44 | // start serial 45 | Serial.begin(9600); 46 | xbee.setSerial(Serial); 47 | nss.begin(9600); 48 | 49 | nss.println("Starting up!"); 50 | } 51 | 52 | // continuously reads packets, looking for ZB Receive or Modem Status 53 | void loop() { 54 | 55 | xbee.readPacket(); 56 | 57 | if (xbee.getResponse().isAvailable()) { 58 | // got something 59 | 60 | if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) { 61 | // got a zb rx packet 62 | 63 | // now fill our zb rx class 64 | xbee.getResponse().getZBRxResponse(rx); 65 | 66 | nss.println("Got an rx packet!"); 67 | 68 | if (rx.getOption() == ZB_PACKET_ACKNOWLEDGED) { 69 | // the sender got an ACK 70 | nss.println("packet acknowledged"); 71 | } else { 72 | nss.println("packet not acknowledged"); 73 | } 74 | 75 | nss.print("checksum is "); 76 | nss.println(rx.getChecksum(), HEX); 77 | 78 | nss.print("packet length is "); 79 | nss.println(rx.getPacketLength(), DEC); 80 | 81 | for (int i = 0; i < rx.getDataLength(); i++) { 82 | nss.print("payload ["); 83 | nss.print(i, DEC); 84 | nss.print("] is "); 85 | nss.println(rx.getData()[i], HEX); 86 | } 87 | 88 | for (int i = 0; i < xbee.getResponse().getFrameDataLength(); i++) { 89 | nss.print("frame data ["); 90 | nss.print(i, DEC); 91 | nss.print("] is "); 92 | nss.println(xbee.getResponse().getFrameData()[i], HEX); 93 | } 94 | } 95 | } else if (xbee.getResponse().isError()) { 96 | nss.print("error code:"); 97 | nss.println(xbee.getResponse().getErrorCode()); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /examples/Series2_Sleep/Series2_Sleep.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | /* 24 | This example is for Series 2 (ZigBee) XBee Radios only, though Series 1 also support sleep mode. 25 | This example demonstrates the XBee pin sleep setting, by allowing the Arduino 26 | to sleep/wake the XBee. In this example and end device is attached to the Arduino. 27 | 28 | The end device sleep mode must be set to 1 (SM=1), to enable pin sleep. 29 | Set SP=AF0 (28 seconds) on the coordinator. This will instruct the coordinator to buffer any packets, for up to 28 seconds, 30 | while the end device is sleeping. When the end device wakes, it will poll the coordinator and receive the packet. 31 | 32 | Note: I'm using the SoftSerial library to communicate with the Arduino since the Arduino's Serial is being used by the XBee 33 | 34 | How it works: 35 | When you send a "1", the Arduino will sleep the XBee. 36 | Sending "2" wakes the XBee and "3" will send an arbitrary TX packet. 37 | Of course if the XBee is sleeping, the TX packet will not be delivered. 38 | Connect the Arduino Serial Monitor to the usb-serial device to send the commands. 39 | Connect an LED to the XBee Module Status (pin 13). This will turn on when the XBee is awake and off when it's sleeping 40 | Attach the coordinator to your computer and send a TX packet ever 28 seconds. You should be able to verify the 41 | end device receives the packet when it wakes from sleep. 42 | 43 | Remember to connect all devices to a common Ground: XBee, Arduino and USB-Serial device 44 | */ 45 | 46 | // create the XBee object 47 | XBee xbee = XBee(); 48 | 49 | // create an arbitrary payload -- what we're sending is not relevant 50 | uint8_t payload[] = { 0, 0 }; 51 | 52 | // SH + SL Address of a remote XBee 53 | XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x403e0f30); 54 | ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload)); 55 | ZBTxStatusResponse txStatus = ZBTxStatusResponse(); 56 | ZBRxResponse rx = ZBRxResponse(); 57 | 58 | // note: xbee sleep pin doesn't need 3.3. to sleep -- open circuit also will sleep it, but of course it needs 0V to wake! 59 | // connect Arduino digital 7 to XBee sleep pin (9) through a voltage divider. I'm using a 10K resistor. 60 | uint8_t sleepPin = 7; 61 | 62 | // SoftSerial RX: connect Arduino digitial 8 to the TX of of usb-serial device. note: I'm using Modern Device's USB BUB (set to 5V). You can use a 3.3V usb-serial with a voltage divider on RX (TX does not require since Arduino is 3.3V tolerant) 63 | uint8_t ssRX = 8; 64 | // SoftSerial TX: connect Arduino digital 9 to RX of usb-serial device 65 | uint8_t ssTX = 9; 66 | 67 | SoftwareSerial nss(ssRX, ssTX); 68 | 69 | void setup() { 70 | pinMode(sleepPin, OUTPUT); 71 | // set to LOW (wake) 72 | digitalWrite(sleepPin, LOW); 73 | 74 | // start XBee communication 75 | Serial.begin(9600); 76 | xbee.setSerial(Serial); 77 | // start soft serial 78 | nss.begin(9600); 79 | } 80 | 81 | void sendPacket() { 82 | 83 | nss.println("Sending a packet"); 84 | 85 | xbee.send(zbTx); 86 | 87 | // after sending a tx request, we expect a status response 88 | // wait up to 5 seconds for the status response 89 | if (xbee.readPacket(5000)) { 90 | // got a response! 91 | 92 | // should be a znet tx status 93 | if (xbee.getResponse().getApiId() == ZB_TX_STATUS_RESPONSE) { 94 | xbee.getResponse().getZBTxStatusResponse(txStatus); 95 | 96 | // get the delivery status, the fifth byte 97 | if (txStatus.getDeliveryStatus() == SUCCESS) { 98 | // success. time to celebrate 99 | nss.println("packet was delivered"); 100 | } else { 101 | // the remote XBee did not receive our packet. is it powered on? 102 | nss.println("packet delivery failed"); 103 | } 104 | } else if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) { 105 | // we received a packet something! 106 | xbee.getResponse().getZBRxResponse(rx); 107 | // print the payload. lets assume it's text. 108 | for (uint8_t i = 0; i < rx.getDataLength(); i++) { 109 | nss.println(rx.getData(i)); 110 | } 111 | } 112 | } else { 113 | // local xbee is sleeping 114 | nss.println("no response -- is local xbee sleeping?"); 115 | } 116 | } 117 | 118 | void loop() { 119 | if (nss.available()) { 120 | int cmd = nss.read(); 121 | 122 | // ascii 1 == 49 123 | if (cmd == 49) { // 1 (ASCII) 124 | // sleep XBee 125 | digitalWrite(sleepPin, HIGH); 126 | nss.println("sleeping xbee"); 127 | } else if (cmd == 50) { // 2 (ASCII) 128 | digitalWrite(sleepPin, LOW); 129 | nss.println("waking xbee"); 130 | } else if (cmd == 51) { // 3 (ASCII) 131 | // send packet 132 | sendPacket(); 133 | } else { 134 | nss.println("I didn't understand"); 135 | } 136 | } 137 | 138 | readPacket(); 139 | } 140 | 141 | // when XBee powers up it sends a modem status 0 (hardware reset), followed by a 2 (Joined Network), assumming it's configured correctly 142 | // when XBee is woken up it sends a modem status 2 (Joined Network) 143 | 144 | void readPacket() { 145 | xbee.readPacket(); 146 | 147 | if (xbee.getResponse().isAvailable()) { 148 | // got something.. print packet to nss 149 | nss.print("API="); 150 | nss.print(xbee.getResponse().getApiId(), HEX); 151 | nss.print(",frame="); 152 | 153 | // print frame data 154 | for (int i = 0; i < xbee.getResponse().getFrameDataLength(); i++) { 155 | nss.print(xbee.getResponse().getFrameData()[i], HEX); 156 | nss.print(" "); 157 | } 158 | 159 | nss.println(""); 160 | } else if (xbee.getResponse().isError()) { 161 | nss.print("XBee error. error code is"); 162 | nss.println(xbee.getResponse().getErrorCode(), DEC); 163 | } 164 | } 165 | 166 | -------------------------------------------------------------------------------- /examples/Series2_Tx/Series2_Tx.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Andrew Rapp. All rights reserved. 3 | * 4 | * This file is part of XBee-Arduino. 5 | * 6 | * XBee-Arduino is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * XBee-Arduino is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBee-Arduino. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | /* 23 | This example is for Series 2 XBee 24 | Sends a ZB TX request with the value of analogRead(pin5) and checks the status response for success 25 | */ 26 | 27 | // create the XBee object 28 | XBee xbee = XBee(); 29 | 30 | uint8_t payload[] = { 0, 0 }; 31 | 32 | // SH + SL Address of receiving XBee 33 | XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x403e0f30); 34 | ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload)); 35 | ZBTxStatusResponse txStatus = ZBTxStatusResponse(); 36 | 37 | int pin5 = 0; 38 | 39 | int statusLed = 13; 40 | int errorLed = 13; 41 | 42 | void flashLed(int pin, int times, int wait) { 43 | 44 | for (int i = 0; i < times; i++) { 45 | digitalWrite(pin, HIGH); 46 | delay(wait); 47 | digitalWrite(pin, LOW); 48 | 49 | if (i + 1 < times) { 50 | delay(wait); 51 | } 52 | } 53 | } 54 | 55 | void setup() { 56 | pinMode(statusLed, OUTPUT); 57 | pinMode(errorLed, OUTPUT); 58 | 59 | Serial.begin(9600); 60 | xbee.setSerial(Serial); 61 | } 62 | 63 | void loop() { 64 | // break down 10-bit reading into two bytes and place in payload 65 | pin5 = analogRead(5); 66 | payload[0] = pin5 >> 8 & 0xff; 67 | payload[1] = pin5 & 0xff; 68 | 69 | xbee.send(zbTx); 70 | 71 | // flash TX indicator 72 | flashLed(statusLed, 1, 100); 73 | 74 | // after sending a tx request, we expect a status response 75 | // wait up to half second for the status response 76 | if (xbee.readPacket(500)) { 77 | // got a response! 78 | 79 | // should be a znet tx status 80 | if (xbee.getResponse().getApiId() == ZB_TX_STATUS_RESPONSE) { 81 | xbee.getResponse().getZBTxStatusResponse(txStatus); 82 | 83 | // get the delivery status, the fifth byte 84 | if (txStatus.getDeliveryStatus() == SUCCESS) { 85 | // success. time to celebrate 86 | flashLed(statusLed, 5, 50); 87 | } else { 88 | // the remote XBee did not receive our packet. is it powered on? 89 | flashLed(errorLed, 3, 500); 90 | } 91 | } 92 | } else if (xbee.getResponse().isError()) { 93 | //nss.print("Error reading packet. Error code: "); 94 | //nss.println(xbee.getResponse().getErrorCode()); 95 | } else { 96 | // local XBee did not provide a timely TX Status Response -- should not happen 97 | flashLed(errorLed, 2, 50); 98 | } 99 | 100 | delay(1000); 101 | } 102 | 103 | -------------------------------------------------------------------------------- /examples/ZdpScan/zigbee.h: -------------------------------------------------------------------------------- 1 | // This file contains defines and structs, taken from 2 | // https://github.com/digidotcom/xbee_ansic_library/blob/master/include/ 3 | // Response headers were modified to include a transaction field and 4 | // some new content was added for the xbee-arduino library. 5 | 6 | /* 7 | * Copyright (c) 2010-2012 Digi International Inc., 8 | * All rights not expressly granted are reserved. 9 | * 10 | * This Source Code Form is subject to the terms of the Mozilla Public 11 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, 12 | * You can obtain one at http://mozilla.org/MPL/2.0/. 13 | * 14 | * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 15 | * ======================================================================= 16 | */ 17 | 18 | 19 | #ifndef __XBEE_ZIGBEE_H 20 | #define __XBEE_ZIGBEE_H 21 | 22 | #define PACKED_STRUCT struct __attribute__((__packed__)) 23 | typedef uint64_t addr64; 24 | 25 | /** 26 | * ZigBee Stack Profile IDs 27 | * 4-bit values used in ZigBee beacons 28 | */ 29 | /// Network Specific 30 | #define WPAN_STACK_PROFILE_PROPRIETARY 0x0 31 | /// ZigBee (2006) 32 | #define WPAN_STACK_PROFILE_ZIGBEE 0x1 33 | /// ZigBee PRO (2007) 34 | #define WPAN_STACK_PROFILE_ZIGBEE_PRO 0x2 35 | 36 | /** 37 | * Profile IDs 38 | */ 39 | /// ZigBee Device Object (aka ZigBee Device Profile) 40 | #define WPAN_PROFILE_ZDO 0x0000 41 | 42 | /// Smart Energy Profile 43 | #define WPAN_PROFILE_SMART_ENERGY 0x0109 44 | 45 | /// Digi International, mfg-specific 46 | #define WPAN_PROFILE_DIGI 0xC105 47 | 48 | /** 49 | * List of fixed endpoints 50 | */ 51 | /// ZigBee Device Object/Profile 52 | #define WPAN_ENDPOINT_ZDO 0x00 53 | /// Digi Smart Energy 54 | #define WPAN_ENDPOINT_DIGI_SE 0x5E 55 | /// Digi Device Objects 56 | #define WPAN_ENDPOINT_DDO 0xE6 57 | /// Digi Data 58 | #define WPAN_ENDPOINT_DIGI_DATA 0xE8 59 | /// Broadcast Endpoint 60 | #define WPAN_ENDPOINT_BROADCAST 0xFF 61 | //@} 62 | 63 | // Status values 64 | #define ZDO_STATUS_SUCCESS 0x00 65 | // 0x01 to 0x7F are reserved 66 | #define ZDO_STATUS_INV_REQUESTTYPE 0x80 67 | #define ZDO_STATUS_DEVICE_NOT_FOUND 0x81 68 | #define ZDO_STATUS_INVALID_EP 0x82 69 | #define ZDO_STATUS_NOT_ACTIVE 0x83 70 | #define ZDO_STATUS_NOT_SUPPORTED 0x84 71 | #define ZDO_STATUS_TIMEOUT 0x85 72 | #define ZDO_STATUS_NO_MATCH 0x86 73 | // 0x87 is reserved 74 | #define ZDO_STATUS_NO_ENTRY 0x88 75 | #define ZDO_STATUS_NO_DESCRIPTOR 0x89 76 | #define ZDO_STATUS_INSUFFICIENT_SPACE 0x8A 77 | #define ZDO_STATUS_NOT_PERMITTED 0x8B 78 | #define ZDO_STATUS_TABLE_FULL 0x8C 79 | #define ZDO_STATUS_NOT_AUTHORIZED 0x8D 80 | 81 | /// Cluster IDs with the high bit set are responses. 82 | #define ZDO_CLUST_RESPONSE_MASK 0x8000 83 | #define ZDO_CLUST_IS_RESPONSE(c) (c & ZDO_CLUST_RESPONSE_MASK) 84 | 85 | /********************************************************* 86 | Simple Descriptor 87 | **********************************************************/ 88 | /// cluster ID for ZDO Simple_Desc request 89 | #define ZDO_SIMPLE_DESC_REQ 0x0004 90 | /// cluster ID for ZDO Simple_Desc response 91 | #define ZDO_SIMPLE_DESC_RSP 0x8004 92 | /// frame format for ZDO Simple_Desc request 93 | typedef PACKED_STRUCT zdo_simple_desc_req_t { 94 | uint8_t transaction; 95 | uint16_t network_addr_le; 96 | uint8_t endpoint; ///< 0x01 to 0xFE 97 | } zdo_simple_desc_req_t; 98 | 99 | /// header for ZDO Simple_Desc response, followed by a SimpleDescriptor 100 | typedef PACKED_STRUCT zdo_simple_desc_resp_header_t { 101 | uint8_t transaction; 102 | uint8_t status; ///< see ZDO_STATUS_* macros 103 | uint16_t network_addr_le; ///< device's network address (little-endian) 104 | uint8_t length; ///< length of simple descriptor 105 | // variable-length simple descriptor follows 106 | } zdo_simple_desc_resp_header_t; 107 | 108 | /// header for ZDO SimpleDescriptor (part of a Simple_Desc response), followed 109 | /// by uint8_t input cluster count, multiple uint16_t input cluster IDs, 110 | /// uint8_t output cluster count, multiple uint16_t output cluster IDs 111 | typedef PACKED_STRUCT zdo_simple_desc_header_t { 112 | uint8_t endpoint; ///< 0x01 to 0xFE 113 | uint16_t profile_id_le; ///< endpoint's profile ID (little-endian) 114 | uint16_t device_id_le; ///< endpoint's device ID (little-endian) 115 | uint8_t device_version; ///< upper 4 bits are reserved 116 | // variable-length cluster counts and ids follow 117 | } zdo_simple_desc_header_t; 118 | 119 | 120 | /********************************************************* 121 | Active EP Descriptor 122 | **********************************************************/ 123 | /// cluster ID for ZDO Active_EP request 124 | #define ZDO_ACTIVE_EP_REQ 0x0005 125 | /// cluster ID for ZDO Active_EP response 126 | #define ZDO_ACTIVE_EP_RSP 0x8005 127 | /// frame format for ZDO Active_EP request 128 | /// @see zdo_send_descriptor_req() 129 | typedef PACKED_STRUCT zdo_active_ep_req_t { 130 | uint8_t transaction; 131 | uint16_t network_addr_le; 132 | } zdo_active_ep_req_t; 133 | 134 | /// header for ZDO Active_EP response, followed by \c .ep_count 135 | /// uint8_t endpoints 136 | typedef PACKED_STRUCT zdo_active_ep_rsp_header_t { 137 | uint8_t transaction; 138 | uint8_t status; ///< see ZDO_STATUS_* macros 139 | uint16_t network_addr_le; 140 | uint8_t ep_count; 141 | uint8_t endpoints[]; 142 | } zdo_active_ep_rsp_header_t; 143 | 144 | /********************************************************* 145 | Management LQI Request 146 | **********************************************************/ 147 | 148 | /// cluster ID for ZDO LQI Request 149 | #define ZDO_MGMT_LQI_REQ 0x0031 150 | /// cluster ID for ZDO LQI Response 151 | #define ZDO_MGMT_LQI_RSP 0x8031 152 | 153 | /// frame format for a ZDO LQI Request 154 | typedef PACKED_STRUCT zdo_mgmt_lqi_req_t { 155 | uint8_t transaction; 156 | uint8_t start_index; 157 | } zdo_mgmt_lqi_req_t; 158 | 159 | /// frame format for a ZDO LQI Table Entry 160 | typedef PACKED_STRUCT zdo_mgmt_lqi_entry_t { 161 | uint64_t extended_pan_id_le; 162 | uint64_t extended_addr_le; 163 | uint16_t nwk_addr_le; 164 | uint8_t flags0; 165 | #define ZDO_MGMT_LQI_REQ_TYPE_COORDINATOR 0x0 166 | #define ZDO_MGMT_LQI_REQ_TYPE_ROUTER 0x1 167 | #define ZDO_MGMT_LQI_REQ_TYPE_ENDDEVICE 0x2 168 | #define ZDO_MGMT_LQI_REQ_TYPE_UNKNOWN 0x3 169 | uint8_t flags1; 170 | uint8_t depth; 171 | uint8_t lqi; 172 | } zdo_mgt_lqi_entry_t; 173 | 174 | /// frame format for a ZDO LQI Response 175 | typedef PACKED_STRUCT zdo_mgmt_lqi_rsp_t { 176 | uint8_t transaction; 177 | uint8_t status; 178 | uint8_t table_entries; 179 | uint8_t start_index; 180 | uint8_t list_count; 181 | zdo_mgmt_lqi_entry_t entries[]; 182 | } zdo_mgmt_lqi_rsp_t; 183 | 184 | 185 | #endif // __XBEE_ZIGBEE_H 186 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | XBee KEYWORD1 2 | XBeeResponse KEYWORD1 3 | readPacket KEYWORD2 4 | readPacketUntilAvailable KEYWORD2 5 | begin KEYWORD2 6 | send KEYWORD2 7 | getResponse KEYWORD2 8 | getNextFrameId KEYWORD2 9 | setSerial KEYWORD2 10 | 11 | -------------------------------------------------------------------------------- /library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "XBee", 3 | "keywords": "xbee, protocol, radio, rf, 802.15.4", 4 | "description": "XBees in API mode, with support for both Series 1 (802.15.4) and Series 2 (ZB Pro/ZNet)", 5 | "repository": 6 | { 7 | "type": "git", 8 | "url": "https://github.com/andrewrapp/xbee-arduino.git" 9 | }, 10 | "include": 11 | [ 12 | "*.cpp", 13 | "*.h", 14 | "examples" 15 | ], 16 | "frameworks": "arduino", 17 | "platforms": "atmelavr" 18 | } 19 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=XBee-Arduino library 2 | version=0.6.0 3 | author=Andrew Rapp 4 | maintainer=Andrew Rapp 5 | sentence=Library for talking to to various wireless XBee modules from Digi. 6 | paragraph=This supports various devices, configured to use the more advanced "API" mode. 7 | category=Communication 8 | url=https://github.com/andrewrapp/xbee-arduino 9 | architectures=* 10 | --------------------------------------------------------------------------------