Afif JEBALI / Mbed 2 deprecated testCom

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 Serial ant(D1, D0); //tx, rx
00004 Serial pc(D5,D4);
00005 char temp[8];
00006 int b_ok = 0;
00007 int main() {
00008     pc.printf("AT$SF=%04x%04x\r\n",200,120);
00009     while(1) {
00010        // for(int i =0; i < 100; i++){
00011             if(ant.readable())
00012             {
00013                 ant.gets(temp,4);
00014                 for(int i =0; i < 4;i++){
00015                     if(temp[i]=='b')
00016                         b_ok=1;
00017                 }
00018                 if(b_ok==0){
00019                    //pc.printf("AT$SF=%02x%02x\r\n",20,12);
00020                    //wait(2);
00021                    temp[0]='n';
00022                    break;
00023                 }
00024             }
00025         //}
00026         pc.printf("com : %c",temp[0]);
00027         wait(0.5);
00028         b_ok = 0;
00029         //pc.printf(temp);
00030     }
00031 }