Nathan MONNIER
/
Projet_S3
Projet_S3
serie.h@13:ae981a954016, 2022-02-04 (annotated)
- Committer:
- nmonnier
- Date:
- Fri Feb 04 09:51:52 2022 +0000
- Revision:
- 13:ae981a954016
- Parent:
- 10:6f9340af7926
- Child:
- 14:5b7129157c7b
Projet mbed S3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dujardin | 6:edb27e228558 | 1 | // variables globales liées à la reception serie |
dujardin | 8:cfcf73c16fab | 2 | int arecv = 0 ; // stockage intermediaire du char arrivé |
dujardin | 8:cfcf73c16fab | 3 | |
dujardin | 8:cfcf73c16fab | 4 | void interrupt() // reception sur liaison serie |
dujardin | 8:cfcf73c16fab | 5 | { // ici on decode un exemple simple |
dujardin | 8:cfcf73c16fab | 6 | // un 'a' met posx = 10 un 'b' met posx = 20 |
dujardin | 8:cfcf73c16fab | 7 | arecv = serie.getc(); |
nmonnier | 13:ae981a954016 | 8 | tempo=500; |
dujardin | 10:6f9340af7926 | 9 | if (arecv == 'a') // c'est un 'a' qui arrive |
nmonnier | 13:ae981a954016 | 10 | { |
nmonnier | 13:ae981a954016 | 11 | entrer='a'; // affichage de 1 |
dujardin | 6:edb27e228558 | 12 | } |
dujardin | 10:6f9340af7926 | 13 | if (arecv == 'b')// c'est un 'b' qui arrive |
nmonnier | 13:ae981a954016 | 14 | { |
nmonnier | 13:ae981a954016 | 15 | entrer=arecv; // affichage de 2 |
nmonnier | 13:ae981a954016 | 16 | } |
nmonnier | 13:ae981a954016 | 17 | if (arecv == 'c')// c'est un 'c' qui arrive |
nmonnier | 13:ae981a954016 | 18 | { |
nmonnier | 13:ae981a954016 | 19 | entrer=arecv; // affichage de 3 |
nmonnier | 13:ae981a954016 | 20 | } |
nmonnier | 13:ae981a954016 | 21 | if (arecv == 'z')// c'est un 'z' qui arrive |
nmonnier | 13:ae981a954016 | 22 | { |
nmonnier | 13:ae981a954016 | 23 | entrer=arecv; // affichage de 0 |
nmonnier | 13:ae981a954016 | 24 | } |
dujardin | 6:edb27e228558 | 25 | return; |
dujardin | 8:cfcf73c16fab | 26 | } |