q3

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
brunostgr
Date:
Tue Oct 22 13:41:58 2019 +0000
Commit message:
q3

Changed in this revision

Question3.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
diff -r 000000000000 -r 9b0238b70cf2 Question3.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Question3.cpp	Tue Oct 22 13:41:58 2019 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+
+AnalogIn analog_value(PA_0);        // Entree analogique
+Serial PC(USBTX, USBRX);            // Port USB
+
+Ticker afficheur;
+
+// Declaration des variables
+float mesure;
+float temp;
+
+void affiche(){     // Fonction d'affichage
+    
+    mesure = analog_value.read();   // Assigne une valeur de 0.0 à 1.0 a mesure
+    temp = mesure * 330;         // Conversion en degres Celsius
+        
+    // Affichage de la temperature
+    PC.printf("Temperature = %u C",(unsigned)temp);
+}
+
+// Programme principal
+int main()
+{
+    afficheur.attach(&affiche,0.1); // Ticker appele a toutes les 100 ms
+    while(1) {
+        // Attente
+    }
+}
diff -r 000000000000 -r 9b0238b70cf2 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 22 13:41:58 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file