Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp@0:092cef4ad794, 2020-05-04 (annotated)
- Committer:
- dg81
- Date:
- Mon May 04 12:48:13 2020 +0000
- Revision:
- 0:092cef4ad794
lire sur liaison serie;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| dg81 | 0:092cef4ad794 | 1 | #include "mbed.h" |
| dg81 | 0:092cef4ad794 | 2 | #include "string.h" |
| dg81 | 0:092cef4ad794 | 3 | Serial pc(USBTX, USBRX,19200); // tx, rx sur les broches associées au bus USB |
| dg81 | 0:092cef4ad794 | 4 | int err; |
| dg81 | 0:092cef4ad794 | 5 | char command[9]; |
| dg81 | 0:092cef4ad794 | 6 | int main(void) |
| dg81 | 0:092cef4ad794 | 7 | { |
| dg81 | 0:092cef4ad794 | 8 | while(1) |
| dg81 | 0:092cef4ad794 | 9 | { |
| dg81 | 0:092cef4ad794 | 10 | if (pc.readable()){ |
| dg81 | 0:092cef4ad794 | 11 | |
| dg81 | 0:092cef4ad794 | 12 | err=pc.scanf("%s",command); |
| dg81 | 0:092cef4ad794 | 13 | printf("la commande est : %s \n",command); |
| dg81 | 0:092cef4ad794 | 14 | |
| dg81 | 0:092cef4ad794 | 15 | if(strcmp(command,"marche")==0) { |
| dg81 | 0:092cef4ad794 | 16 | printf("en avant!!!\n"); |
| dg81 | 0:092cef4ad794 | 17 | } |
| dg81 | 0:092cef4ad794 | 18 | |
| dg81 | 0:092cef4ad794 | 19 | if (strcmp(command,"arret")==0){ |
| dg81 | 0:092cef4ad794 | 20 | printf("STOP!!!"); |
| dg81 | 0:092cef4ad794 | 21 | } |
| dg81 | 0:092cef4ad794 | 22 | } |
| dg81 | 0:092cef4ad794 | 23 | |
| dg81 | 0:092cef4ad794 | 24 | } |
| dg81 | 0:092cef4ad794 | 25 | } |
| dg81 | 0:092cef4ad794 | 26 |