Equipo7 LabMicros / Mbed 2 deprecated I2C_1B

Dependencies:   mbed LiquidCrystal_I2C_for_KL25Z

Files at this revision

API Documentation at this revision

Comitter:
micros22eq7
Date:
Mon Apr 25 18:27:42 2022 +0000
Child:
1:f9d42dc8c470
Commit message:
Conexion con LCD con protocolo de comunicacion I2C. Despliegue en LCD de informacion obtenida desde la terminal.

Changed in this revision

LiquidCrystal_I2C_for_KL25Z.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/LiquidCrystal_I2C_for_KL25Z.lib	Mon Apr 25 18:27:42 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/micros22eq7/code/LiquidCrystal_I2C_for_KL25Z/#573860d2e640
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Apr 25 18:27:42 2022 +0000
@@ -0,0 +1,47 @@
+//CÓDIGO 1-B
+
+#include "mbed.h"
+#include "stdlib.h"
+#include <LiquidCrystal_I2C.h>
+#include <iostream>
+#include <string>
+
+Serial pc(USBTX, USBRX); // tx, rx
+
+//Los puertos SDA  y SD8 están referenciados en el archivo LiquidCrystal_I2C.cpp
+// SDA -> PTC9
+// SCL -> PTC8
+//                     DIR   TIPO
+LiquidCrystal_I2C lcd(0x4E, 16, 2);
+
+int main()
+{
+    pc.printf("\x1b[2J");       //CLEAR
+    pc.printf("\033[1;1H");     //Mueve cursor al origen
+    
+    int i, j;
+    char datos[3][5]; // Matriz para almacenar datos
+    
+    // Inicia la LCD
+    lcd.begin();
+    
+    lcd.print("Esperando datos...");
+    pc.printf("\nIngresa 3 numeros decimales de la forma <X.X> SIN PRESIONAR ENTER\r\n");
+    
+    for (i = 0; i < 3; i++) // Obtencion de datos desde terminal
+    {
+        pc.printf("\r\nDato %i: ", i + 1);
+        for (j = 0; j < 3; j ++)
+            datos[i][j] = pc.getc();
+        datos[i][3] = ' ';
+        datos[i][4] = 0;
+        pc.printf("   %s", datos[i]);
+    }
+    lcd.clear();
+    lcd.print("Datos obtenidos:");
+    lcd.print(datos[0]);
+    lcd.print(datos[1]);
+    lcd.print(datos[2]);
+    
+    pc.printf("\n\r\nDatos enviados a la LCD...");
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Apr 25 18:27:42 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file