diff --git a/examples/XBee_AT_Receive/XBee_AT_Receive.ino b/examples/XBee_AT_Receive/XBee_AT_Receive.ino deleted file mode 100644 index de421237..00000000 --- a/examples/XBee_AT_Receive/XBee_AT_Receive.ino +++ /dev/null @@ -1,61 +0,0 @@ -/* - * KiteLib XBee AT Receive Example - * - * This example receives packets using XBee AT mode. - * In AT mode, two XBee modules act like a Serial line. Both modules must have - * the same PAN ID, and the destination addresses have to be set properly. - * - * IMPORTANT: Before uplolading this example, make sure that the XBee module is running - * AT ROUTER firmware! - */ - -// include the library -#include - -// XBee module is in slot A on the shield -XBee bee = Kite.ModuleA; - -void setup() { - Serial.begin(9600); - - // initialize XBee module with baudrate 9600 - Serial.print(F("[XBee] Initializing ... ")); - byte state = bee.begin(9600); - if(state == ERR_NONE) { - Serial.println(F("success!")); - } else { - Serial.print(F("failed, code 0x")); - Serial.println(state, HEX); - while(true); - } - - // set PAN ID to 0123456789ABCDEF - Serial.print(F("[XBee] Setting PAN ID ... ")); - state = bee.setPanId("0123456789ABCDEF"); - if(state == ERR_NONE) { - Serial.println(F("success!")); - } else { - Serial.print(F("failed, code 0x")); - Serial.println(state, HEX); - while(true); - } - - // set destination address to the address of the second module - Serial.print(F("[XBee] Setting destination address ... ")); - state = bee.setDestinationAddress("0013A200", "40A58A52"); - if(state == ERR_NONE) { - Serial.println(F("success!")); - } else { - Serial.print(F("failed, code 0x")); - Serial.println(state, HEX); - while(true); - } -} - -void loop() { - // read data incoming from XBee and write them to Serial - // XBee supports all methods of the Serial class - while(bee.available() > 0) { - Serial.write(bee.read()); - } -} diff --git a/examples/XBee_AT_Transmit/XBee_AT_Transmit.ino b/examples/XBee_Transparent/XBee_Transparent.ino similarity index 66% rename from examples/XBee_AT_Transmit/XBee_AT_Transmit.ino rename to examples/XBee_Transparent/XBee_Transparent.ino index 8e863303..f8cd2a43 100644 --- a/examples/XBee_AT_Transmit/XBee_AT_Transmit.ino +++ b/examples/XBee_Transparent/XBee_Transparent.ino @@ -1,19 +1,20 @@ /* - * KiteLib XBee AT Transmit Example + * KiteLib XBee Transparent Operation Example * - * This example transmits packets using XBee AT mode. - * In AT mode, two XBee modules act like a Serial line. Both modules must have - * the same PAN ID, and the destination addresses have to be set properly. + * This example transmits packets using XBee Transparent mode. + * In Transparent mode, two XBee modules act like a Serial line. + * Both modules must have the same PAN ID, and the destination + * addresses have to be set properly. * - * IMPORTANT: Before uplolading this example, make sure that the XBee module is running - * AT COORDINATOR firmware! + * IMPORTANT: Before uploading this example, make sure that the XBee modules + * are running AT COORDINATOR and AT ROUTER firmware! */ // include the library #include // XBee module is in slot A on the shield -XBee bee = Kite.ModuleA; +XBeeSerial bee = Kite.ModuleA; void setup() { Serial.begin(9600); @@ -53,9 +54,14 @@ void setup() { } void loop() { + // XBeeSerial supports all methods of the Serial class // read data incoming from Serial port and write them to XBee - // XBee supports all methods of the Serial class while(Serial.available() > 0) { bee.write(Serial.read()); } + + // read data incoming from XBee and write them to Serial port + while(bee.available() > 0) { + Serial.write(bee.read()); + } }