![](/media/cache/profiles/25a76ba89c58a499eadfd4cb8ecf8af5.jpg.50x50_q85.jpg)
Code to send all the data from the mbed application board.
main.cpp
- Committer:
- dannellyz
- Date:
- 2015-04-19
- Revision:
- 0:d07e1be874a3
File content as of revision 0:d07e1be874a3:
// 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()