projet neotim mpp / Mbed 2 deprecated 5-readserial

Dependencies:   mbed

main.cpp

Committer:
dg81
Date:
2020-05-04
Revision:
0:092cef4ad794

File content as of revision 0:092cef4ad794:

#include "mbed.h"
#include "string.h"
Serial pc(USBTX, USBRX,19200); // tx, rx sur les broches associées au bus USB
int err;
char command[9];
int main(void)
{
    while(1)
    {
        if (pc.readable()){
            
            err=pc.scanf("%s",command);
            printf("la commande est : %s \n",command);
           
            if(strcmp(command,"marche")==0) {
                printf("en avant!!!\n");
                }
            
            if (strcmp(command,"arret")==0){
                printf("STOP!!!");
                }
            }
            
    }
}