q1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
brunostgr
Date:
Tue Oct 22 13:42:41 2019 +0000
Commit message:
q1

Changed in this revision

Question1.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/Question1.cpp	Tue Oct 22 13:42:41 2019 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+
+AnalogIn analog_value(PA_0);        // Entree analogique
+Serial PC(USBTX, USBRX);            // Port USB
+
+// Programme principal
+int main()
+{
+    // Declaration des variables
+    float mesure;
+    float nombre;
+
+    while(1) {
+
+        mesure = analog_value.read();   // Assigne une valeur de 0.0 à 1.0 a mesure
+        nombre = mesure * 4095;         // Conversion vers un 12-bit integer
+        
+        // Affichage du nombre a 12 bits
+        PC.printf("Lecture = 0x%X",(unsigned)nombre);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 22 13:42:41 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file