Serial check 840
Dependencies: mbed
Revision 0:2c71440840c2, committed 2019-06-19
- Comitter:
- pratiksk
- Date:
- Wed Jun 19 13:36:39 2019 +0000
- Commit message:
- Serail check 840;
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jun 19 13:36:39 2019 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" +#include <string> + +Serial pc(USBTX, USBRX); // pc comunication +Serial SIM900(p6, p8); //tx, rx SIM 900 +string result; +char x; + +void ShowSerialData() { + while (SIM900.readable()) { + x = SIM900.getc(); + result += x; + pc.printf("%c",x); // print the answer from SIM900 + } +} + +int i = 0; +int main() { + while (i < 5) { + pc.printf("AT \n"); + SIM900.printf("AT"); /* Check Communication */ + wait(5000); + ShowSerialData(); + i = i + 1; + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jun 19 13:36:39 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file