Code to send all the data from the mbed application board.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
dannellyz
Date:
Sun Apr 19 19:36:23 2015 +0000
Commit message:
code to send app board info with xbee

Changed in this revision

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
diff -r 000000000000 -r d07e1be874a3 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Apr 19 19:36:23 2015 +0000
@@ -0,0 +1,22 @@
+// Example of formulating a string to send all appBaord data serial over XBEE
+/******************Declaration of necessary libraries and objects************************/  
+#include "mbed.h"
+BusIn joy(p15,p12,p13,p16); //Initialize joystick bus
+AnalogIn pot1(p19);         //Potentiometer 1
+AnalogIn pot2(p20);         //Potentiometer 2
+Serial pc(USBTX, USBRX);    //Initialize PC serial comms
+Serial xbeeOut(p9, p10);    //tx, rx via Xbee socket
+int main() {
+/******************While loop call to run code indefinitely******************************/
+    while(1) {
+        //This can be customized to take any other internal or external sensors
+        int joystick = joy;
+        float Lpot = pot1;
+        float Rpot = pot2;
+        //Echo locally for error checking
+        printf("$APPBOARD,%.02f,%.02f,%d\r\n",Lpot,Rpot,joystick);
+        //Use the same serial fictions as above the transmit over XBee
+        xbeeOut.printf("$APPBOARD,%.02f,%.02f,%d\r\n",Lpot,Rpot,joystick);
+        wait(.1);//Short pause to avoid going over the through put     
+    }//while(1)
+}//main()
diff -r 000000000000 -r d07e1be874a3 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Apr 19 19:36:23 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file