wei zou
/
Mbed_Shield_GPRS_AT_Command_Test
this is a AT command test on Mbed Shield
main.cpp
#include "mbed.h" Serial gprs(p28,p27); Serial pc(USBTX,USBRX); int main() { char buffer[64]; int count = 0; pc.baud(19200); gprs.baud(19200); while(1) { if(gprs.readable()) { while(gprs.readable()) { char c = gprs.getc(); buffer[count++] = c; if(count == 64) break; } pc.puts(buffer); for(int i = 0; i < count; i++) { buffer[i] = NULL; } count = 0; } if(pc.readable()) { gprs.putc(pc.getc()); } } }
Revision 0:c310471929e7, committed 2013-11-20
- Comitter:
- lawliet
- Date:
- Wed Nov 20 07:53:14 2013 +0000
- Commit message:
- Initial verison of testing AT Commands on Mbed Shield
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 c310471929e7 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Nov 20 07:53:14 2013 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" + +Serial gprs(p28,p27); +Serial pc(USBTX,USBRX); + +int main() +{ + char buffer[64]; + int count = 0; + pc.baud(19200); + gprs.baud(19200); + while(1) { + if(gprs.readable()) { + while(gprs.readable()) { + char c = gprs.getc(); + buffer[count++] = c; + if(count == 64) break; + } + pc.puts(buffer); + for(int i = 0; i < count; i++) { + buffer[i] = NULL; + } + count = 0; + } + if(pc.readable()) { + gprs.putc(pc.getc()); + } + } +}
diff -r 000000000000 -r c310471929e7 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Nov 20 07:53:14 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file