Aditya Barve
/
Xbee_transmitter
This consists of the transmitter code to send characters wirelessly using the Zigbee protocol.
Revision 0:e7abcef0b57f, committed 2012-12-07
- Comitter:
- abarve9
- Date:
- Fri Dec 07 07:29:32 2012 +0000
- Commit message:
- The transmitter code used to transmit characters wirelessly using Zigbee protocol.
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 e7abcef0b57f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 07 07:29:32 2012 +0000 @@ -0,0 +1,44 @@ +/// SENDER ZIGBEE + +#include "mbed.h" +#include "iostream" +#include "stdio.h" +#include "stdlib.h" +using namespace std; + +Serial pc(USBTX, USBRX); + +Serial xbee1(p9,p10); +DigitalOut rst1(p11); //Digital reset for the XBee, 200ns for reset + + +DigitalOut myled(LED1);//Create variable for Led 3 on the mbed + +int main() +{ + int character; + char buffer[20]; + rst1 = 0; //Set reset pin to 0 + myled = 0;//Set LED3 to 0 + wait_ms(1);//Wait at least one millisecond + rst1 = 1;//Set reset pin to 1 + wait_ms(1);//Wait another millisecond + + + while (1) + + { + if(pc.readable()) { + //pc.gets(buffer,10); + //xbee1.putc(buffer); //XBee write whatever the PC is sending + myled = !myled; + character = pc.getc(); + xbee1.putc(character); + pc.putc(character); + + } + + //pc.printf("I got %s on sending side \n", buffer); + wait(.1); + } +} \ No newline at end of file
diff -r 000000000000 -r e7abcef0b57f mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Dec 07 07:29:32 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49c296715c73 \ No newline at end of file