Pecunia_Insper
/
Main
VEjam se o MAin funciona
Diff: main.cpp
- Revision:
- 2:3cd315d7a107
- Parent:
- 1:405e88f6e720
diff -r 405e88f6e720 -r 3cd315d7a107 main.cpp --- a/main.cpp Tue May 15 13:13:23 2018 +0000 +++ b/main.cpp Tue May 22 13:00:27 2018 +0000 @@ -17,7 +17,7 @@ DigitalIn bot_4(D7); int x=0; - +int p=0; int main() { // Luz lcd.setCursor(TextLCD::CurOff_BlkOn); @@ -33,9 +33,6 @@ //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); @@ -45,15 +42,16 @@ //} //return 0; while (true) { -if (x ==0) +if (x == 0 & bot_1 == 1 & bot_2 == 1 & bot_3 == 1 & bot_4 == 1) { - lcd.cls(); lcd.setAddress(0,0); - lcd.printf("Selecionar pontos (1)"); + lcd.printf("Selec. pontos (1) "); lcd.setAddress(0,1); - lcd.printf("Tertar programa (2)"); + lcd.printf("Testar tarefa (2) "); lcd.setAddress(0,2); - lcd.printf("Realizar programa (3)"); + lcd.printf("Realizar tarefa (3) "); + lcd.setAddress(0,3); + lcd.printf(" "); if (bot_1 == 0 ) { x=1; @@ -67,35 +65,216 @@ x=3; } } -if (x ==1) +if (x ==1 & bot_1 == 1 & bot_2 == 1 & bot_3 == 1 & bot_4 == 1) + { + lcd.setAddress(0,0); + lcd.printf("Gravar ponto 1 (1) "); + lcd.setAddress(0,1); + lcd.printf("Cancelar (2) "); + lcd.setAddress(0,2); + lcd.printf(" "); + lcd.setAddress(0,3); + lcd.printf(" "); + if (bot_1 == 0 ) + { + x=4; + } + if (bot_2 == 0 ) + { + x=0; + } + } +if (x ==2 & bot_1 == 1 & bot_2 == 1 & bot_3 == 1 & bot_4 == 1) { lcd.cls(); + wait(0.2); lcd.setAddress(0,0); - lcd.printf("Gravar ponto 1 (1)"); - lcd.setAddress(0,1); - lcd.printf("Cancelar (2)"); + lcd.printf(" "); + lcd.setAddress(p,1); + lcd.printf(" TESTANDO "); + lcd.setAddress(0,2); + lcd.printf(" PONTOS "); + lcd.setAddress(0,3); + lcd.printf(" "); + wait(0.5); } -if (x ==2) +if (x ==3 & bot_1 == 1 & bot_2 == 1 & bot_3 == 1 & bot_4 == 1) { lcd.cls(); + wait(0.2); + lcd.setAddress(0,0); + lcd.printf(" "); + lcd.setAddress(0,1); + lcd.printf(" REALIZANDO "); + lcd.setAddress(0,2); + lcd.printf(" COLAGEM "); + lcd.setAddress(0,3); + lcd.printf(" "); wait(0.5); - lcd.setAddress(6,1); - lcd.printf("TESTANDO"); - lcd.setAddress(7,2); - lcd.printf("PONTOS"); - wait(1); + } +if (x == 4 & bot_1 == 1 & bot_2 == 1 & bot_3 == 1 & bot_4 == 1) + { + lcd.setAddress(0,0); + lcd.printf("Selec. ponto 2 (1) "); + lcd.setAddress(0,1); + lcd.printf("Reescolher P1 (2) "); + lcd.setAddress(0,2); + lcd.printf("Cancelar (3) "); + lcd.setAddress(0,3); + lcd.printf("Concluir (4) "); + if (bot_1 == 0 ) + { + x=5; + } + if (bot_2 == 0 ) + { + x=1; + } + if (bot_3 == 0 ) + { + x=0; + } + if (bot_4 == 0 ) + { + x=0; + } } -if (x ==3) + +if (x == 5 & bot_1 == 1 & bot_2 == 1 & bot_3 == 1 & bot_4 == 1) + { + lcd.setAddress(0,0); + lcd.printf("Selec. ponto 3 (1) "); + lcd.setAddress(0,1); + lcd.printf("Reescolher P2 (2) "); + lcd.setAddress(0,2); + lcd.printf("Cancelar (3) "); + lcd.setAddress(0,3); + lcd.printf("Concluir (4) "); + if (bot_1 == 0 ) + { + x=6; + } + if (bot_2 == 0 ) + { + x=1; + } + if (bot_3 == 0 ) + { + x=0; + } + if (bot_4 == 0 ) + { + x=0; + } + } + +if (x == 6 & bot_1 == 1 & bot_2 == 1 & bot_3 == 1 & bot_4 == 1) + { + lcd.setAddress(0,0); + lcd.printf("Selec. ponto 4 (1) "); + lcd.setAddress(0,1); + lcd.printf("Reescolher P3 (2) "); + lcd.setAddress(0,2); + lcd.printf("Cancelar (3) "); + lcd.setAddress(0,3); + lcd.printf("Concluir (4) "); + if (bot_1 == 0 ) + { + x=7; + } + if (bot_2 == 0 ) + { + x=5; + } + if (bot_3 == 0 ) { - lcd.cls(); - wait(0.5); - lcd.setAddress(5,1); - lcd.printf("REALIZANDO"); - lcd.setAddress(8,2); - lcd.printf("COLAGEM"); - wait(1); + x=0; + } + if (bot_4 == 0 ) + { + x=0; + } + } + +if (x == 7 & bot_1 == 1 & bot_2 == 1 & bot_3 == 1 & bot_4 == 1) + { + lcd.setAddress(0,0); + lcd.printf("Selec. ponto 5 (1) "); + lcd.setAddress(0,1); + lcd.printf("Reescolher P4 (2) "); + lcd.setAddress(0,2); + lcd.printf("Cancelar (3) "); + lcd.setAddress(0,3); + lcd.printf("Concluir (4) "); + if (bot_1 == 0 ) + { + x=8; + } + if (bot_2 == 0 ) + { + x=6; + } + if (bot_3 == 0 ) + { + x=0; + } + if (bot_4 == 0 ) + { + x=0; + } } - +if (x == 8 & bot_1 == 1 & bot_2 == 1 & bot_3 == 1 & bot_4 == 1) + { + lcd.setAddress(0,0); + lcd.printf("Selec. ponto 6 (1) "); + lcd.setAddress(0,1); + lcd.printf("Reescolher P5 (2) "); + lcd.setAddress(0,2); + lcd.printf("Cancelar (3) "); + lcd.setAddress(0,3); + lcd.printf("Concluir (4) "); + if (bot_1 == 0 ) + { + x=9; + } + if (bot_2 == 0 ) + { + x=7; + } + if (bot_3 == 0 ) + { + x=0; + } + if (bot_4 == 0 ) + { + x=0; + } + } + +if (x == 9 & bot_1 == 1 & bot_2 == 1 & bot_3 == 1 & bot_4 == 1) + { + lcd.setAddress(0,0); + lcd.printf("Reescolher P6 (1) "); + lcd.setAddress(0,1); + lcd.printf("Cancelar (2) "); + lcd.setAddress(0,2); + lcd.printf("Concluir (3) "); + lcd.setAddress(0,3); + lcd.printf(" "); + if (bot_1 == 0 ) + { + x=8; + } + if (bot_2 == 0 ) + { + x=0; + } + if (bot_3 == 0 ) + { + x=0; + } + + } //if (x==1) // {lcd.setAddress(1,1); @@ -112,10 +291,6 @@ //b=2; //} - - - - - - - + + } + }