Code for the End Device to Send serial strings to a coordinator

Dependencies:   C12832_lcd mbed xbee_lib

Files at this revision

API Documentation at this revision

Comitter:
dannellyz
Date:
Sun Feb 15 06:05:02 2015 +0000
Commit message:
First Draft of serial comms with xbee.h;

Changed in this revision

C12832_lcd.lib Show annotated file Show diff for this revision Revisions of this file
main.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
diff -r 000000000000 -r 6523d794b09b C12832_lcd.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832_lcd.lib	Sun Feb 15 06:05:02 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/dreschpe/code/C12832_lcd/#8f86576007d6
diff -r 000000000000 -r 6523d794b09b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Feb 15 06:05:02 2015 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "xbee.h" // Include for xbee code
+#include "C12832_lcd.h" // Include for LCD code
+
+xbee xbee1(p9,p10,p30); //Initalise xbee_lib varName(rx,tx,reset)
+DigitalOut rst1(p30);
+Serial pc(USBTX, USBRX); //Initalise PC serial comms
+C12832_LCD lcd; //Initialize LCD Screen
+
+//Code to send strings acsross xbee with xbee.h
+//Code should be on the End Device 
+int main()
+{
+    // reset the xbees (at least 200ns)
+    rst1 = 0;
+    wait_ms(1); 
+    rst1 = 1;
+    wait_ms(1);
+    
+    //Establish a variable to take in data to send to Coordinator
+    //Max buffer is 202
+    char sendData[4]; 
+    
+    //Setup LCD screen
+    lcd.cls();      
+    lcd.locate(0,1);
+    
+    while(1) {
+        //Get information from the user
+        pc.printf("Enter your graduation year: ");
+        pc.scanf("%s", sendData);
+        
+        //Send data to Xbee
+        xbee1.SendData(sendData); 
+        
+        //Echo Locally...
+        pc.printf("Sent: %s \n",sendData);
+        lcd.printf("Sent %s \n", sendData);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 6523d794b09b mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Feb 15 06:05:02 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa
\ No newline at end of file
diff -r 000000000000 -r 6523d794b09b xbee_lib.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xbee_lib.lib	Sun Feb 15 06:05:02 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/tristanjph/code/xbee_lib/#ede20c047d8b