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.
Diff: etape1.h
- Revision:
- 15:41977c40cfbe
- Child:
- 16:9ea7bff0ed03
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etape1.h Mon Dec 20 11:36:17 2021 +0000 @@ -0,0 +1,29 @@ +// EXEMPLE d'actions a faire dans etape1 +// on teste l'inter pour en informer le PC +// on mesure le potentiometre pour en informer le PC +// on mesure P0 pour informer le PC +// wait 0.1ms 10 boucles à la seconde + + +void etape1() + { + // tester broche de l'inter ( entrée logique D2 nommée inter) + if( inter == 1) // test inter sur carte MicroC + { pc.putc('w'); } + if( inter == 0) // test inter sur carte MicroC + { pc.putc('v'); } + // tester la tension sur P0 en analogique + P = P0.read(); // regarde la tension sur P0 + if ( P > 0.51 ) pc.putc('s'); + if ( P < 0.49 ) pc.putc('r'); + + // mesure de la tension sur le potentiometre transfert en duj10 + simVs = simulVs.read(); // lire le potentiomètre + out = 333*simVs ; // mettre dans une echelle 0 à 333 + pc.putc('D'); // ouvrir le transfert par D + pc.printf("%d", out); // duj10 du pot ( de 0 à 333) + pc.putc('P'); // fermer par P pour potentiometre + + + wait(0.1); + } \ No newline at end of file