TP

Dependencies:   mbed LCD

Files at this revision

API Documentation at this revision

Comitter:
theilor
Date:
Mon May 16 17:38:33 2022 +0000
Commit message:
led tp

Changed in this revision

LCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /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
--- /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
--- /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