![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
VEjam se o MAin funciona
main.cpp
- Committer:
- brunolleite
- Date:
- 2018-05-15
- Revision:
- 1:405e88f6e720
- Parent:
- 0:5661dfef7807
- Child:
- 2:3cd315d7a107
File content as of revision 1:405e88f6e720:
#include "mbed.h" #include "TextLCD.h" // Host PC Communication channels Serial pc(USBTX, USBRX); // tx, rx // I2C Communication I2C i2c_lcd(D14,D15); // SDA, SCL TextLCD_I2C lcd(&i2c_lcd, 0x7F, TextLCD::LCD20x4); // I2C bus, PCF8574 Slaveaddress, LCD Type //DigitalIn mybutton(USER_BUTTON); // definindo o user button DigitalIn bot_1(D4); DigitalIn bot_2(D5); DigitalIn bot_3(D6); DigitalIn bot_4(D7); int x=0; int main() { // Luz lcd.setCursor(TextLCD::CurOff_BlkOn); lcd.setBacklight(TextLCD::LightOn); //lcd.setAddress(5,2); //lcd.printf("salve"); //wait_ms(2000); //lcd.cls(); //lcd.setAddress(5,2); //lcd.printf("..."); //wait_ms(2000); //lcd.cls(); //lcd.setAddress(5,2); //lcd.printf("seu otario"); lcd.printf("salve"); int a; a = 0; //printf("nmero: %d \n", a); //while (a < 10) //{lcd.setAddress(a,0); //lcd.printf("%d \n", a); //a=a+1; //wait_ms(1000); //} //return 0; while (true) { if (x ==0) { lcd.cls(); lcd.setAddress(0,0); lcd.printf("Selecionar pontos (1)"); lcd.setAddress(0,1); lcd.printf("Tertar programa (2)"); lcd.setAddress(0,2); lcd.printf("Realizar programa (3)"); if (bot_1 == 0 ) { x=1; } if (bot_2 == 0 ) { x=2; } if (bot_3 == 0 ) { x=3; } } if (x ==1) { lcd.cls(); lcd.setAddress(0,0); lcd.printf("Gravar ponto 1 (1)"); lcd.setAddress(0,1); lcd.printf("Cancelar (2)"); } if (x ==2) { lcd.cls(); wait(0.5); lcd.setAddress(6,1); lcd.printf("TESTANDO"); lcd.setAddress(7,2); lcd.printf("PONTOS"); wait(1); } if (x ==3) { lcd.cls(); wait(0.5); lcd.setAddress(5,1); lcd.printf("REALIZANDO"); lcd.setAddress(8,2); lcd.printf("COLAGEM"); wait(1); } //if (x==1) // {lcd.setAddress(1,1); // lcd.cls(); // lcd.printf("estado %d \n", a); // a=a+1; // x=0; // } //if (x==2|| b == 1) // {lcd.setAddress(1,1); // lcd.cls(); // lcd.printf("troca de estado %d \n", a); //a=a+1; //b=2; //}