Este es el que funciona, de momento. No está probado con muchos valores de entradas. Falta probar eso.

Files at this revision

API Documentation at this revision

Comitter:
luisquiroga
Date:
Mon Dec 09 12:09:29 2019 +0000
Parent:
106:d323dd088ba2
Commit message:
Este es el que funciona, de momento.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r d323dd088ba2 -r 5674ae43e215 main.cpp
--- a/main.cpp	Fri Nov 22 16:00:04 2019 +0000
+++ b/main.cpp	Mon Dec 09 12:09:29 2019 +0000
@@ -3,21 +3,26 @@
  * SPDX-License-Identifier: Apache-2.0
  */
 
-#include "mbed.h"
-#include "platform/mbed_thread.h"
+#include<mbed.h>
 
 
-// Blinking rate in milliseconds
-#define BLINKING_RATE_MS                                                    500
+AnalogIn signal(GPIO0);
+Serial pc(USBTX, USBRX);
 
 
 int main()
 {
-    // Initialise the digital pin LED1 as an output
-    DigitalOut led(LED1);
-
+    //Declaro las variables
+    float Tension = 0;
+    unsigned short adcValor;
+    pc.baud(9600); //Baudrate
+    
     while (true) {
-        led = !led;
-        thread_sleep_for(BLINKING_RATE_MS);
+        
+            adcValor = signal.read_u16();
+            float flotante = signal.read();
+            //Tension = (adcValor * 3.3/255); // Lo paso a valor de tension
+        
+            pc.printf("El valor del ADC %i y leido directo %.2f \r\n", adcValor, flotante); // Imprimo en terminal
     }
 }