THEILOR LIROY
/
TP53
TP
Revision 0:08b3a1ec047a, committed 2022-05-16
- Comitter:
- theilor
- Date:
- Mon May 16 17:38:33 2022 +0000
- Commit message:
- led tp
Changed in this revision
diff -r 000000000000 -r 08b3a1ec047a LCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD.lib Mon May 16 17:38:33 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/HarishMekali/code/LCD/#0b293534b6b1
diff -r 000000000000 -r 08b3a1ec047a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon May 16 17:38:33 2022 +0000 @@ -0,0 +1,64 @@ +#include "mbed.h" + +AnalogIn pot1(p19); // Potentiomètre 1 +AnalogIn pot2(p20); // Potentiomètre 2 + +Timer Tcalcul,Taffichage ; // Timer +int a, b ; // Compteur + +float ReadPot1=0, ReadPot=0, Moy1=0,Moy=0; + +// Fonction lecture des potentiometres + +void LecturePot() +{ + ReadPot1 = ReadPot1+ pot1.read(); + ReadPot2 = ReadPot2+ pot2.read(); + a++; + b++; +} + + +// Fonction de calcul des potentiometres + +void Moyenne() +{ + Tcalcul.start(); + + Moy1= ReadPot1/a; + Moy2= ReadPot2/b; + + Tcalcul.stop(); + +} + + + +// Fonction d'affichage des moyennes +void Affichage() +{ + Taffichage.start(); + lcd.cls(); + lcd.printf("MoyennePot1: %f MoyennePot2: %f ",Moy1,Moy2); + lcd.printf("Temps de calcul : %f Temps d'affichage: %f",Tcalcul,Taffichage); + + Taffichage.stop(); + +} + + + + +int main() +{ + while(1) + { + LecturePot(); + Moyenne(); + Affichage(); + } + + + + +} \ No newline at end of file
diff -r 000000000000 -r 08b3a1ec047a mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon May 16 17:38:33 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file