Dependencies: mbed
Revision 0:f9299e8f33a9, committed 2016-04-14
- Comitter:
- chasefarmer2808
- Date:
- Thu Apr 14 22:44:20 2016 +0000
- Commit message:
- Setting up xbee class
Changed in this revision
diff -r 000000000000 -r f9299e8f33a9 Xbee.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Xbee.cpp Thu Apr 14 22:44:20 2016 +0000 @@ -0,0 +1,9 @@ +#include "Xbee.h" + +Xbee::Xbee(PinName tx, PinName rx) : xbee(tx, rx) { + +} + +void Xbee::processCommand(char* com) { + +} \ No newline at end of file
diff -r 000000000000 -r f9299e8f33a9 Xbee.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Xbee.h Thu Apr 14 22:44:20 2016 +0000 @@ -0,0 +1,9 @@ +#include "mbed.h" + +class Xbee { +public: + Serial xbee; + + Xbee(PinName tx, PinName rx); + void processCommand(char* com); +}; \ No newline at end of file
diff -r 000000000000 -r f9299e8f33a9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Apr 14 22:44:20 2016 +0000 @@ -0,0 +1,34 @@ +#include "Xbee.h" + +Serial pc(USBTX, USBRX); // tx, rx +Serial device(p13, p14); // tx, rx + +int main() { + //char packet[128]; + //char recieved[128]; + + Xbee* xbee = new Xbee(p13, p14); + + while (1) { + if(pc.readable()) { //sending + //pc.gets(packet, 10); + //pc.printf(packet); + //printf("\r\n"); + //device.puts(packet); //transmits what you type + xbee->xbee.putc(pc.getc()); + } + if(device.readable()) { //recieving + + printf("Recieved from Ground Station: "); + + //pc.putc(device.getc()); //recieves transmission and prints to serial monitor + //device.gets(recieved, 10); + + //pc.printf(recieved); + pc.putc(xbee->xbee.getc()); + printf("\r\n"); + + //xbee.processCommand(); + } + } +} \ No newline at end of file
diff -r 000000000000 -r f9299e8f33a9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Apr 14 22:44:20 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/99a22ba036c9 \ No newline at end of file