Fernando Morales / Mbed 2 deprecated I2C_1_B

Dependencies:   mbed

main.cpp

Committer:
fernando_moraless
Date:
2022-04-25
Revision:
2:b2512ade96de
Parent:
1:b2c40f461dbd
Child:
3:59d6245cad22

File content as of revision 2:b2512ade96de:

//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];
    
    // Inicia the LCD
    lcd.begin();

    // Turn on the blacklight.
    lcd.backlight();
    
    lcd.print("Esperando ...");
    pc.printf("\nIngresa 3 datos de 4 caracteres al programa por medio de la terminal: ");
    for (i = 0; i < 3; i++)
    {
        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;
    }
    lcd.clear();
    lcd.print(datos[0]);
    lcd.print(datos[1]);
    lcd.print(datos[2]);
}