Menu para a IHM

Dependencies:   TextLCD mbed

Fork of TextLCD_HelloWorld2 by Wim Huiskamp

Committer:
digo1234
Date:
Mon May 07 20:56:41 2018 +0000
Revision:
6:49a35089f51b
Parent:
5:9936706721a8
NOVO MENU DO NOT?O

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wim 4:a3e4bb2053cb 1 /* Hello World! for the TextLCD Enhanced Library*/
wim 0:a75049de1a82 2
wim 0:a75049de1a82 3 #include "mbed.h"
wim 0:a75049de1a82 4 #include "TextLCD.h"
digo1234 5:9936706721a8 5 //#include "TextLCDScroll.h"
digo1234 6:49a35089f51b 6 DigitalIn button1(D5);
digo1234 6:49a35089f51b 7 DigitalIn button2(D4);
digo1234 5:9936706721a8 8
digo1234 5:9936706721a8 9 DigitalOut led(LED2);
wim 4:a3e4bb2053cb 10
wim 0:a75049de1a82 11 // Host PC Communication channels
wim 0:a75049de1a82 12 Serial pc(USBTX, USBRX); // tx, rx
wim 4:a3e4bb2053cb 13
wim 0:a75049de1a82 14 // I2C Communication
digo1234 5:9936706721a8 15 I2C i2c_lcd(D14,D15); // SDA, SCL
digo1234 5:9936706721a8 16
digo1234 5:9936706721a8 17
digo1234 5:9936706721a8 18 TextLCD_I2C lcd(&i2c_lcd, 0x7E, TextLCD::LCD20x4); // I2C exp: I2C bus, PCF8574 Slaveaddress, LCD Type
digo1234 5:9936706721a8 19
digo1234 6:49a35089f51b 20 bool saida=0;
wim 0:a75049de1a82 21
digo1234 6:49a35089f51b 22
wim 4:a3e4bb2053cb 23 int main() {
wim 0:a75049de1a82 24
digo1234 5:9936706721a8 25 lcd.setBacklight(TextLCD::LightOn);
digo1234 5:9936706721a8 26 lcd.setCursor(TextLCD::CurOff_BlkOn);
wim 4:a3e4bb2053cb 27
digo1234 6:49a35089f51b 28
digo1234 6:49a35089f51b 29 while(1){
digo1234 6:49a35089f51b 30 while (button1==1 and button2==1){
digo1234 6:49a35089f51b 31 saida=0;
digo1234 5:9936706721a8 32 lcd.setAddress(0,0);
digo1234 6:49a35089f51b 33 lcd.printf("SELECIONAR PONTO? ");
digo1234 6:49a35089f51b 34 lcd.setAddress(0,2);
digo1234 6:49a35089f51b 35 lcd.printf("1-SIM");
digo1234 6:49a35089f51b 36 lcd.setAddress(0,3);
digo1234 6:49a35089f51b 37 lcd.printf("2-NAO");
digo1234 6:49a35089f51b 38 }
digo1234 6:49a35089f51b 39 if (button1==0){
digo1234 6:49a35089f51b 40 lcd.cls();
digo1234 6:49a35089f51b 41 while(1){
digo1234 6:49a35089f51b 42 lcd.setAddress(0,0);
digo1234 6:49a35089f51b 43 lcd.printf("SELECIONE O PONTO 1");
digo1234 6:49a35089f51b 44 lcd.setCursor(TextLCD::CurOff_BlkOff);
digo1234 6:49a35089f51b 45 lcd.setAddress(0,2);
digo1234 6:49a35089f51b 46 lcd.printf("1-PROXIMO PONTO");
digo1234 6:49a35089f51b 47 lcd.setAddress(0,3);
digo1234 6:49a35089f51b 48 lcd.printf("2-VOLTAR");
digo1234 6:49a35089f51b 49 if (button1==0){
digo1234 6:49a35089f51b 50 lcd.cls();
digo1234 6:49a35089f51b 51 while(1){
digo1234 6:49a35089f51b 52 lcd.setAddress(0,0);
digo1234 6:49a35089f51b 53 lcd.printf("SELECIONE O PONTO 2");
digo1234 6:49a35089f51b 54 lcd.setCursor(TextLCD::CurOff_BlkOff);
digo1234 6:49a35089f51b 55 lcd.setAddress(0,2);
digo1234 6:49a35089f51b 56 lcd.printf("1-PROXIMO PONTO");
digo1234 6:49a35089f51b 57 }
digo1234 6:49a35089f51b 58
digo1234 6:49a35089f51b 59 }
digo1234 6:49a35089f51b 60 if (button2==0){
digo1234 6:49a35089f51b 61 lcd.cls();
digo1234 6:49a35089f51b 62 saida = 1;
digo1234 6:49a35089f51b 63 break;
digo1234 6:49a35089f51b 64 }
digo1234 6:49a35089f51b 65 }
digo1234 6:49a35089f51b 66 }
digo1234 6:49a35089f51b 67 if (button2==0 and saida==0){
digo1234 6:49a35089f51b 68 lcd.cls();
digo1234 6:49a35089f51b 69 while(1){
digo1234 6:49a35089f51b 70 lcd.setAddress(5,1);
digo1234 6:49a35089f51b 71 lcd.printf("OPERACAO");
digo1234 6:49a35089f51b 72 lcd.setCursor(TextLCD::CurOff_BlkOff);
digo1234 6:49a35089f51b 73 lcd.setAddress(5,2);
digo1234 6:49a35089f51b 74 lcd.printf("CANCELADA");
digo1234 6:49a35089f51b 75
digo1234 6:49a35089f51b 76 }
digo1234 6:49a35089f51b 77 }
wim 4:a3e4bb2053cb 78 }
digo1234 6:49a35089f51b 79 }
wim 3:f238b4f7874f 80
wim 3:f238b4f7874f 81