proyectotecnicas / Mbed 2 deprecated analoginaterminal

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
josedaparte
Date:
Thu Nov 26 23:48:02 2015 +0000
Commit message:
imprime valor analogico de 0 a 3,3 en terminal

Changed in this revision

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/main.cpp	Thu Nov 26 23:48:02 2015 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+#include "AnalogIn.h"
+
+AnalogIn leer(PTC2);
+Serial pc(USBTX,USBRX);
+
+int main(void)
+{
+    float voltaje;
+    uint16_t adcvalue;
+    pc.baud(115200);
+    
+    while(1){
+        adcvalue = leer.read_u16();
+        voltaje = adcvalue*3.3/65525;
+        pc.printf("el voltaje es %.2f\r\n", voltaje);
+        wait(0.8);
+        }
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 26 23:48:02 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/165afa46840b
\ No newline at end of file