Menu para a IHM

Dependencies:   TextLCD mbed

Fork of TextLCD_HelloWorld2 by Wim Huiskamp

main.cpp

Committer:
digo1234
Date:
2018-05-07
Revision:
6:49a35089f51b
Parent:
5:9936706721a8

File content as of revision 6:49a35089f51b:

/* Hello World! for the TextLCD Enhanced Library*/

#include "mbed.h"
#include "TextLCD.h"
//#include "TextLCDScroll.h"
DigitalIn button1(D5);
DigitalIn button2(D4);

DigitalOut led(LED2);
 
// Host PC Communication channels
Serial pc(USBTX, USBRX); // tx, rx
 
// I2C Communication
I2C i2c_lcd(D14,D15); // SDA, SCL


TextLCD_I2C lcd(&i2c_lcd, 0x7E, TextLCD::LCD20x4);                  // I2C exp: I2C bus, PCF8574 Slaveaddress, LCD Type

bool saida=0;


int main() {   

    lcd.setBacklight(TextLCD::LightOn);
    lcd.setCursor(TextLCD::CurOff_BlkOn);
 
 
  while(1){
        while (button1==1 and button2==1){
            saida=0;
            lcd.setAddress(0,0);
            lcd.printf("SELECIONAR PONTO? ");
            lcd.setAddress(0,2);
            lcd.printf("1-SIM");
            lcd.setAddress(0,3);
            lcd.printf("2-NAO");
            }
            if (button1==0){
                lcd.cls();
                while(1){
                    lcd.setAddress(0,0);
                    lcd.printf("SELECIONE O PONTO 1");
                    lcd.setCursor(TextLCD::CurOff_BlkOff);
                    lcd.setAddress(0,2);
                    lcd.printf("1-PROXIMO PONTO");
                    lcd.setAddress(0,3);
                    lcd.printf("2-VOLTAR");
                    if (button1==0){
                        lcd.cls();
                        while(1){
                            lcd.setAddress(0,0);
                            lcd.printf("SELECIONE O PONTO 2");
                            lcd.setCursor(TextLCD::CurOff_BlkOff);
                            lcd.setAddress(0,2);
                            lcd.printf("1-PROXIMO PONTO");
                        }
                        
                    }
                    if (button2==0){
                        lcd.cls();
                        saida = 1;
                        break;
                    }
                }
            }
            if (button2==0 and saida==0){
                lcd.cls();
                while(1){
                    lcd.setAddress(5,1);
                    lcd.printf("OPERACAO");
                    lcd.setCursor(TextLCD::CurOff_BlkOff);
                    lcd.setAddress(5,2);
                    lcd.printf("CANCELADA");
                    
                }
            }
    }
}