Xbee Comm Test 2

Dependencies:   mbed xbee_lib

Files at this revision

API Documentation at this revision

Comitter:
ricefireflighter
Date:
Mon Feb 17 16:59:07 2014 +0000
Commit message:
Xbee2

Changed in this revision

A.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
xbee_lib.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/A.cpp	Mon Feb 17 16:59:07 2014 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include "xbee.h"
+#include "PwmOut.h"
+
+int main()
+{
+    
+    class xbee xbee1(PTD3,PTD2,PTD0); // Define xbee1 as an xbee class per xbee.h library
+    
+    DigitalOut gled(LED_GREEN); // Initialize green led
+    DigitalOut rled(LED_RED); // Initialize red led
+    gled = 1;
+    gled = 1;
+    
+    //Configure xbee with PanID of 6969 and exit config mode. Vary LED status.
+    //xbee1.ConfigMode();
+    //wait(1);
+    //xbee1.SetPanId(6969);
+    //xbee1.ExitConfigMode();
+    
+    //char send_data[202]; //Xbee buffer size is 202 bytes
+    //send_data = 1;
+    char read_data[202]; //Xbee buffer size is 202 bytes
+    
+    while(1){
+        
+        rled = 0;
+        xbee1.RecieveData(read_data,0);
+        // Line above receives data from xbee to FRDM as a char using getc. 
+        // See function definition for more info.
+        
+        // Transfer information in read.data character string to useful motor/servo info here.
+        
+        if (read_data == "B") {
+            
+            gled = 0;
+            wait(3);
+           
+        }
+            
+        wait(2); 
+        // Wait for some amount of time to allow for complete data to be sent/received
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 17 16:59:07 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xbee_lib.lib	Mon Feb 17 16:59:07 2014 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/tristanjph/code/xbee_lib/#6455a079bdb3