Daniel G. Jaramillo / Mbed 2 deprecated ComunicacionSerial-WindowsForm

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
ZirkofDGJ
Date:
Tue Nov 17 05:01:11 2015 +0000
Commit message:
Comunicacion Serial con LCD 16x2

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
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/TextLCD.lib	Tue Nov 17 05:01:11 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Nov 17 05:01:11 2015 +0000
@@ -0,0 +1,59 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+TextLCD lcd(PTB2, PTB3, PTB10, PTB11, PTC11, PTC10, TextLCD::LCD16x2); // rs, e, d4-d7
+AnalogIn V(PTC2);
+Serial PC(USBTX, USBRX);
+DigitalOut LED(PTB22);
+
+void Config_ptos(void);
+void Proceso(void);
+void Presentacion(void);
+void Lectura(void);
+
+float Vr = 3.3, Df = 0.991;
+float Vd, Vo;
+
+int main()
+{
+    Config_ptos();
+    while(1) {
+        Proceso();
+    }
+}
+
+void Config_ptos(void)
+{
+    PC.format(8, Serial::None, 1);
+    PC.baud(9600);
+    LED = 1;
+}
+
+
+void Proceso(void)
+{
+    //if(PC.readable()) {
+        if(PC.getc()=='A') {
+            LED = 1;
+        }
+
+        if(PC.getc()=='B') {
+            LED = 0;
+        }
+
+    //}
+
+    //if(PC.writeable()) {
+        Vo = V.read();
+        Vd = Vr * Vo/ Df;
+
+        lcd.locate(0,0);
+        lcd.printf("V = %f V", Vd);
+
+        PC.printf("V = %f V\n", Vd);
+        PC.printf("\r\n");
+
+        wait_ms(500);
+        lcd.cls();
+    //}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 17 05:01:11 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file