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.
main.cpp
00001 #include "mbed.h" 00002 00003 AnalogIn pot1(p19); // Potentiomètre 1 00004 AnalogIn pot2(p20); // Potentiomètre 2 00005 00006 Timer Tcalcul,Taffichage ; // Timer 00007 int a, b ; // Compteur 00008 00009 float ReadPot1=0, ReadPot=0, Moy1=0,Moy=0; 00010 00011 // Fonction lecture des potentiometres 00012 00013 void LecturePot() 00014 { 00015 ReadPot1 = ReadPot1+ pot1.read(); 00016 ReadPot2 = ReadPot2+ pot2.read(); 00017 a++; 00018 b++; 00019 } 00020 00021 00022 // Fonction de calcul des potentiometres 00023 00024 void Moyenne() 00025 { 00026 Tcalcul.start(); 00027 00028 Moy1= ReadPot1/a; 00029 Moy2= ReadPot2/b; 00030 00031 Tcalcul.stop(); 00032 00033 } 00034 00035 00036 00037 // Fonction d'affichage des moyennes 00038 void Affichage() 00039 { 00040 Taffichage.start(); 00041 lcd.cls(); 00042 lcd.printf("MoyennePot1: %f MoyennePot2: %f ",Moy1,Moy2); 00043 lcd.printf("Temps de calcul : %f Temps d'affichage: %f",Tcalcul,Taffichage); 00044 00045 Taffichage.stop(); 00046 00047 } 00048 00049 00050 00051 00052 int main() 00053 { 00054 while(1) 00055 { 00056 LecturePot(); 00057 Moyenne(); 00058 Affichage(); 00059 } 00060 00061 00062 00063 00064 }
Generated on Sat Oct 29 2022 12:52:24 by
1.7.2