Báscula de cebo funcionado.

Dependencies:   mbed TextLCD

Committer:
bertonieto
Date:
Thu Apr 11 06:44:22 2019 +0000
Revision:
3:8db024073f1f
Parent:
1:93d8becc35f9
u

Who changed what in which revision?

UserRevisionLine numberNew contents of line
oscarvzfz 0:376d7a150177 1 #include "mbed.h"
oscarvzfz 0:376d7a150177 2 #include "TextLCD.h"
bertonieto 1:93d8becc35f9 3 #include <string>
oscarvzfz 0:376d7a150177 4
bertonieto 3:8db024073f1f 5
oscarvzfz 0:376d7a150177 6
bertonieto 3:8db024073f1f 7 //Iniciamos I2C Communication
bertonieto 3:8db024073f1f 8 //I2C i2c_lcd(p28,p27); // SDA, SCL
bertonieto 3:8db024073f1f 9 I2C i2c_lcd(p32, p31); // SDA, SCL
bertonieto 3:8db024073f1f 10 TextLCD_I2C lcd(&i2c_lcd, 0x4E, TextLCD::LCD16x2, TextLCD::HD44780); // I2C bus, PCF8574 Slaveaddress, LCD Type, Device Type
oscarvzfz 0:376d7a150177 11
bertonieto 1:93d8becc35f9 12 //Iniciamos el LCD.
bertonieto 3:8db024073f1f 13 void iniciaLCD()
bertonieto 3:8db024073f1f 14 {
bertonieto 1:93d8becc35f9 15 lcd.setMode(TextLCD::DispOn); //DispOff, DispOn
bertonieto 1:93d8becc35f9 16 lcd.setBacklight(TextLCD::LightOff);//LightOff, LightOn
bertonieto 1:93d8becc35f9 17 lcd.setCursor(TextLCD::CurOff_BlkOff);//CurOff_BlkOff, CurOn_BlkOff, CurOff_BlkOn, CurOn_BlkOn
bertonieto 3:8db024073f1f 18 }
oscarvzfz 0:376d7a150177 19
bertonieto 3:8db024073f1f 20 //Pintamos en el LCD linea 1.
bertonieto 3:8db024073f1f 21 void pintaLCD1(bool manual){
bertonieto 3:8db024073f1f 22 if (manual){
bertonieto 3:8db024073f1f 23 lcd.locate(0,0);
bertonieto 3:8db024073f1f 24 lcd.printf(" MANUAL ");
bertonieto 1:93d8becc35f9 25 }
bertonieto 3:8db024073f1f 26 else{
bertonieto 3:8db024073f1f 27 lcd.locate(0,0);
bertonieto 3:8db024073f1f 28 lcd.printf("Salida1 Salida2");
bertonieto 3:8db024073f1f 29 }
bertonieto 1:93d8becc35f9 30 }
bertonieto 1:93d8becc35f9 31
bertonieto 1:93d8becc35f9 32 //Main, aqui ponemos todo el programa.
bertonieto 3:8db024073f1f 33 int main()
bertonieto 3:8db024073f1f 34 {
bertonieto 3:8db024073f1f 35 Serial pc(USBTX, USBRX);
bertonieto 1:93d8becc35f9 36 iniciaLCD(); //Iniciamos el LCD
bertonieto 3:8db024073f1f 37 pintaLCD1(0);
bertonieto 3:8db024073f1f 38 //printf
bertonieto 3:8db024073f1f 39 }