Recepteur_SE

Dependencies:   mbed

main.cpp

Committer:
3521456
Date:
2019-10-15
Revision:
0:a839a51c5cec

File content as of revision 0:a839a51c5cec:

#include "mbed.h"

Serial ant(D1, D0); //tx, rx
Serial pc(D5,D4);
char temp[8];
int b_ok = 0;
int main() {
    pc.printf("AT$SF=%04x%04x\r\n",200,120);
    while(1) {
       // for(int i =0; i < 100; i++){
            if(ant.readable())
            {
                ant.gets(temp,4);
                for(int i =0; i < 4;i++){
                    if(temp[i]=='b')
                        b_ok=1;
                }
                if(b_ok==0){
                   //pc.printf("AT$SF=%02x%02x\r\n",20,12);
                   //wait(2);
                   temp[0]='n';
                   break;
                }
            }
        //}
        pc.printf("com : %c",temp[0]);
        wait(0.5);
        b_ok = 0;
        //pc.printf(temp);
    }
}