Vishal Rai
/
SerialXbee_NITH
simple program with serial communication
Revision 0:4373931b350e, committed 2016-05-29
- Comitter:
- rockstar
- Date:
- Sun May 29 17:28:15 2016 +0000
- Commit message:
- NITH version
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 4373931b350e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun May 29 17:28:15 2016 +0000 @@ -0,0 +1,40 @@ +#include "mbed.h" + +DigitalOut myled(LED2); +Serial xbee(PTE0,PTE1); +Serial pc(USBTX,USBRX); +int main() { + pc.printf("We are here"); + xbee.baud(9600); + pc.baud(9600); + while(1) { + if(xbee.readable()) + { int val= xbee.getc(); + pc.putc(val);} + if(pc.readable()) + {char val1= pc.getc(); + xbee.putc(val1);} + myled = !myled; + wait(1); + } + }/* +Serial pc(USBTX, USBRX); //enable serial port which links to USB +AnalogIn Ain(p20); +Timer t; +float ADCdata; + +int main() { + pc.printf("ADC Data Values…\n\r"); //send an opening text message + while(1){ + t.start(); + ADCdata=0; + for (int i=0;i<=9;i++) { + ADCdata=ADCdata + Ain; //sum 10 samples + } + ADCdata=(ADCdata/10)*3.3; //divide by 10 + wait(0.5); + pc.printf("%1.3f \n\r",ADCdata); //send the data to the terminal + t.stop(); + printf("The time taken was %f seconds\n", t.read()); + } +}*/ \ No newline at end of file
diff -r 000000000000 -r 4373931b350e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun May 29 17:28:15 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8ed44a420e5c \ No newline at end of file