testando

Dependencies:   mbed TextLCD2

Committer:
Hiroball
Date:
Mon Jun 01 18:29:19 2020 +0000
Revision:
61:be02d7d4e208
Parent:
60:e2c632e8dee1
Child:
63:32ba7c4becfc
Todos os inputs colocados;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
enricoan 29:76d952358896 1 //local para inclusao de bibliotecas
enricoan 10:4f49e9859535 2 #include "mbed.h"
enricoan 10:4f49e9859535 3 #include "TextLCD.h"
amandarm 31:acb062a05984 4 #include "funcoes_ihm.h"
amandarm 38:2a0e12322e72 5 #include "classe.h"
enricoan 33:a513498222c7 6 #include <stdio.h>
enricoan 33:a513498222c7 7 #include <string>
amandarm 35:a8256801e9ab 8
enricoan 29:76d952358896 9 //local para a declaracao de varioveis
enricoan 30:179ceb3e5791 10 float t_motor = 0.002; //delay entre o acionamento de uma bobina do motor e a outra
enricoan 30:179ceb3e5791 11 float t_teclado = 0.01; //delay entre a leitura de um botão do teclado, necessário para que um click nao gere mais de uma saída
enricoan 24:38820e43b9fe 12 int hor[] = {12,6,3,9}; //valores que, ao serem convertidos em binário, geram a sequência de acionamento do motor no sentido horário enviando a sequência de 0's e 1's às bobinas
enricoan 24:38820e43b9fe 13 int antihor[] = {3,6,12,9}; //valores que, ao serem convertidos em binário, geram a sequência de acionamento do motor no sentido anti-horário enviando a sequência de 0's e 1's às bobinas
enricoan 24:38820e43b9fe 14 int parado[] = {0,0,0,0}; //valores enviados às bobinas do motor para deixá-lo parado
enricoan 30:179ceb3e5791 15 char tecla; //variável que guarda a tecla apertada no teclado
enricoan 30:179ceb3e5791 16 float coord_x = 0; //variável que guardará a posição linear do eixo x, ela é incrementada com a conta do deslocamento linear dado um deslocamento angular sempre que o eixo é movimentado depois do referencimaneto
enricoan 30:179ceb3e5791 17 float coord_y = 0; //variável que guardará a posição linear do eixo y, ela é incrementada com a conta do deslocamento linear dado um deslocamento angular sempre que o eixo é movimentado depois do referencimaneto
enricoan 30:179ceb3e5791 18 float coord_z = 0; //variável que guardará a posição linear do eixo z, ela é incrementada com a conta do deslocamento linear dado um deslocamento angular sempre que o eixo é movimentado depois do referencimaneto
enricoan 30:179ceb3e5791 19 int est_x = 0; //variável que indicará o estado do eixo x, pemitindo ou não que ele possa ser avançado depois de atingir o fim de curso
enricoan 30:179ceb3e5791 20 int est_y = 0; //variável que indicará o estado do eixo y, pemitindo ou não que ele possa ser avançado depois de atingir o fim de curso
enricoan 30:179ceb3e5791 21 int est_z = 0; //variável que indicará o estado do eixo z, pemitindo ou não que ele possa ser avançado depois de atingir o fim de curso
enricoan 17:4d0b8ed791e0 22
enricoan 29:76d952358896 23 //pinos usados pelos botoes de fim de curso
enricoan 17:4d0b8ed791e0 24 DigitalIn fdc_x(PC_10);
enricoan 17:4d0b8ed791e0 25 DigitalIn fdc_y(PC_11);
enricoan 17:4d0b8ed791e0 26 DigitalIn fdc_z(PC_12);
enricoan 20:81a44a25b21d 27
enricoan 29:76d952358896 28 //Iterrupcao botao de emergência
enricoan 43:cfc3da0299ff 29 InterruptIn interrupcao(PC_14);
amandarm 25:b0db528c1985 30
enricoan 42:a6fbbe536814 31 //pinos do rele, saida digital para acionar o rele se necessario, dada uma entrada no pino da emergencia
enricoan 30:179ceb3e5791 32 DigitalOut rele1(PC_5);
enricoan 30:179ceb3e5791 33 DigitalOut rele2(PB_9);
amandarm 25:b0db528c1985 34
enricoan 29:76d952358896 35 //botoes para movimentacao eixo a eixo
enricoan 10:4f49e9859535 36 DigitalIn x_mais(PA_0);
enricoan 10:4f49e9859535 37 DigitalIn x_menos(PA_1);
enricoan 10:4f49e9859535 38 DigitalIn y_mais(PC_0);
enricoan 10:4f49e9859535 39 DigitalIn y_menos(PC_1);
enricoan 10:4f49e9859535 40 DigitalIn z_mais(PC_2);
enricoan 10:4f49e9859535 41 DigitalIn z_menos(PC_3);
enricoan 10:4f49e9859535 42
enricoan 10:4f49e9859535 43 //pinos da placa usados na biblioteca do LCD
enricoan 42:a6fbbe536814 44 //TextLCD lcd(D4, D5, D6, D7, D8, D9);
enricoan 10:4f49e9859535 45
enricoan 16:70baa0057a76 46 //pinos do teclado
enricoan 40:39263f4cf8b7 47 DigitalIn b(PC_4);
enricoan 40:39263f4cf8b7 48 DigitalIn a(PB_0);
enricoan 40:39263f4cf8b7 49 DigitalIn t_0(PC_13);
enricoan 40:39263f4cf8b7 50 DigitalIn t_1(PB_7);
enricoan 40:39263f4cf8b7 51 DigitalIn t_2(PD_2);
enricoan 41:9709891f77c5 52 DigitalIn t_3(PA_4);
enricoan 40:39263f4cf8b7 53 DigitalIn t_4(PB_12);
enricoan 40:39263f4cf8b7 54 DigitalIn t_5(PB_15);
enricoan 41:9709891f77c5 55 DigitalIn t_6(PA_7);
enricoan 40:39263f4cf8b7 56 DigitalIn t_7(PB_14);
enricoan 40:39263f4cf8b7 57 DigitalIn t_8(PA_6);
enricoan 40:39263f4cf8b7 58 DigitalIn t_9(PB_13);
enricoan 16:70baa0057a76 59
enricoan 10:4f49e9859535 60 //pinos de saída para os motores
enricoan 10:4f49e9859535 61 //eixo x
Hiroball 11:dc557e461dfd 62 BusOut eixox(PA_15,PA_14,PA_13,PA_12);
enricoan 10:4f49e9859535 63 //eixo y
Hiroball 11:dc557e461dfd 64 BusOut eixoy(PA_11,PA_10,PB_2,PB_1);
enricoan 10:4f49e9859535 65 //eixo z
Hiroball 11:dc557e461dfd 66 BusOut eixoz(PC_9,PC_8,PB_8,PC_6);
enricoan 10:4f49e9859535 67
enricoan 42:a6fbbe536814 68 //funcao para receber inputs do teclado
enricoan 43:cfc3da0299ff 69 char pega_tecla(){
enricoan 43:cfc3da0299ff 70 if (b == 0)return ('A');
enricoan 43:cfc3da0299ff 71 if (a == 0)return('B');
enricoan 43:cfc3da0299ff 72 if (t_0 == 0)return('0');
enricoan 43:cfc3da0299ff 73 if (t_1 == 0)return('1');
enricoan 43:cfc3da0299ff 74 if (t_2 == 0)return('2');
enricoan 43:cfc3da0299ff 75 if (t_3 == 0)return('3');
enricoan 43:cfc3da0299ff 76 if (t_4 == 0)return('4');
enricoan 43:cfc3da0299ff 77 if (t_5 == 0)return('5');
enricoan 43:cfc3da0299ff 78 if (t_6 == 0)return('6');
enricoan 43:cfc3da0299ff 79 if (t_7 == 0)return('7');
enricoan 43:cfc3da0299ff 80 if (t_8 == 0)return('8');
enricoan 54:74a215a1f76b 81 if (t_9 == 0)return('9');
enricoan 54:74a215a1f76b 82 return('k');}
enricoan 42:a6fbbe536814 83
enricoan 32:2a9b30e1e7ab 84 //funcao de movimentacao dos motores
enricoan 32:2a9b30e1e7ab 85 void mov_x_menos(){for(int i = 0; i < 4; i++){eixox = antihor[i];wait(t_motor);coord_x -= (5.625*5/32)/360;est_x = 0;}}
enricoan 32:2a9b30e1e7ab 86 void mov_y_menos(){for(int i = 0; i < 4; i++){eixoy = antihor[i];wait(t_motor);coord_y -= (5.625*5/32)/360;est_y = 0;}}
enricoan 32:2a9b30e1e7ab 87 void mov_z_menos(){for(int i = 0; i < 4; i++){eixoz = antihor[i];wait(t_motor);coord_z -= (5.625*5/32)/360;est_z = 0;}}
enricoan 32:2a9b30e1e7ab 88 void mov_x_mais() {for(int i = 0; i < 4; i++){eixox = hor[i];wait(t_motor);coord_x += (5.625*5/32)/360;est_x = 0;}}
enricoan 32:2a9b30e1e7ab 89 void mov_y_mais() {for(int i = 0; i < 4; i++){eixoy = hor[i];wait(t_motor);coord_y += (5.625*5/32)/360;est_y = 0;}}
enricoan 32:2a9b30e1e7ab 90 void mov_z_mais() {for(int i = 0; i < 4; i++){eixoz = hor[i];wait(t_motor);coord_z += (5.625*5/32)/360;est_z = 0;}}
enricoan 32:2a9b30e1e7ab 91
enricoan 32:2a9b30e1e7ab 92 //Funcao de interrupcao
enricoan 32:2a9b30e1e7ab 93 void emergencia(){TextLCD lcd(D4, D5, D6, D7, D8, D9);
enricoan 32:2a9b30e1e7ab 94 rele1 = 0;
amandarm 25:b0db528c1985 95 eixox = 0b0000;
amandarm 25:b0db528c1985 96 eixoy = 0b0000;
amandarm 25:b0db528c1985 97 eixoz = 0b0000;
amandarm 25:b0db528c1985 98 lcd.cls();
enricoan 29:76d952358896 99 lcd.printf("Botao Emergencia");
amandarm 25:b0db528c1985 100 lcd.locate(0,1);
amandarm 25:b0db528c1985 101 lcd.printf(" acionado ");
amandarm 25:b0db528c1985 102 lcd.locate(0,2);
amandarm 46:e73e36a20134 103 lcd.printf("Operacao pausada");
amandarm 46:e73e36a20134 104 wait(5);}
enricoan 56:e748b9bd5e3c 105
enricoan 29:76d952358896 106 //Funcao de zeramento
amandarm 57:e26deee15b8f 107
amandarm 27:45f8125a0c0b 108 void zeramento(){
amandarm 27:45f8125a0c0b 109 while (fdc_x != 0){for(int i = 0; i < 4; i++){eixox = hor[i];wait(t_motor);est_x = 1;}}
amandarm 27:45f8125a0c0b 110 while (fdc_y != 0){for(int i = 0; i < 4; i++){eixoy = hor[i];wait(t_motor);est_y = 1;}}
enricoan 54:74a215a1f76b 111 while (fdc_z != 0){for(int i = 0; i < 4; i++){eixoz = hor[i];wait(t_motor);est_z = 1;}}}
enricoan 29:76d952358896 112
enricoan 54:74a215a1f76b 113 //Variaveis para operacao IHM
enricoan 29:76d952358896 114 using std::string;
enricoan 32:2a9b30e1e7ab 115 string status_tela = "zeramento";
amandarm 35:a8256801e9ab 116 int programa = 0;
enricoan 29:76d952358896 117
amandarm 55:4d071fb49f24 118 float pos_x_pega = 0;
amandarm 55:4d071fb49f24 119 float pos_y_pega = 0;
amandarm 55:4d071fb49f24 120 float medida_lado_pega=0;
amandarm 55:4d071fb49f24 121 float volume_pega = 0;
amandarm 55:4d071fb49f24 122 int tipo_pega=0;
amandarm 55:4d071fb49f24 123
amandarm 55:4d071fb49f24 124 float dimensao_solta=0;
amandarm 55:4d071fb49f24 125
amandarm 55:4d071fb49f24 126 float volume_solta_1=0;
amandarm 55:4d071fb49f24 127 float volume_solta_2=0;
amandarm 55:4d071fb49f24 128 float volume_solta_3=0;
amandarm 55:4d071fb49f24 129 float volume_solta_4=0;
amandarm 55:4d071fb49f24 130 float volume_solta_5=0;
amandarm 55:4d071fb49f24 131 float volume_solta_6=0;
amandarm 55:4d071fb49f24 132 float volume_solta_7=0;
amandarm 55:4d071fb49f24 133 float volume_solta_8=0;
amandarm 55:4d071fb49f24 134 float volume_solta_9=0;
amandarm 55:4d071fb49f24 135
amandarm 55:4d071fb49f24 136 float pos_x_solta=0;
amandarm 55:4d071fb49f24 137 float pos_y_solta=0;
amandarm 55:4d071fb49f24 138
amandarm 57:e26deee15b8f 139 //main
amandarm 57:e26deee15b8f 140
enricoan 29:76d952358896 141 int main() {
enricoan 56:e748b9bd5e3c 142 interrupcao.fall(&emergencia);
enricoan 54:74a215a1f76b 143 int volume;
Hiroball 61:be02d7d4e208 144 int volume_solta;
Hiroball 61:be02d7d4e208 145 int diametro_solta;
Hiroball 61:be02d7d4e208 146 int diametro;
Hiroball 59:447534f1e4f5 147 int comprimento_quad;
enricoan 54:74a215a1f76b 148 bool continuar;
Hiroball 61:be02d7d4e208 149 int multiplicador = 10;
enricoan 32:2a9b30e1e7ab 150 TextLCD lcd(D4, D5, D6, D7, D8, D9);
enricoan 29:76d952358896 151 lcd.printf("Bem-vindo ao Pipemax");
enricoan 29:76d952358896 152 lcd.locate(0,1);
enricoan 29:76d952358896 153 lcd.printf("o seu sistema");
enricoan 29:76d952358896 154 lcd.locate(0,2);
enricoan 29:76d952358896 155 lcd.printf("automatizado");
enricoan 29:76d952358896 156 lcd.locate(0,3);
enricoan 29:76d952358896 157 lcd.printf("de pipetagem");
enricoan 33:a513498222c7 158 wait(3);
enricoan 28:c4733814201a 159 lcd.cls();
enricoan 29:76d952358896 160 lcd.printf("Por favor, aceite");
amandarm 27:45f8125a0c0b 161 lcd.locate(0,1);
enricoan 29:76d952358896 162 lcd.printf("o zeramento do seu");
amandarm 27:45f8125a0c0b 163 lcd.locate(0,2);
enricoan 29:76d952358896 164 lcd.printf("sistema");
amandarm 27:45f8125a0c0b 165 lcd.locate(0,3);
enricoan 56:e748b9bd5e3c 166 lcd.printf("A - proximo");
enricoan 33:a513498222c7 167 while(1) {
enricoan 50:cd54c98b6ef1 168 tecla = pega_tecla();
enricoan 50:cd54c98b6ef1 169 printf("\n%s",status_tela);
enricoan 50:cd54c98b6ef1 170 printf("\n%c",tecla);
enricoan 29:76d952358896 171 if(tecla == 'A' && status_tela == "zeramento"){
amandarm 27:45f8125a0c0b 172 zeramento();
enricoan 33:a513498222c7 173 status_tela = "inicio";
enricoan 29:76d952358896 174 funcao_inicio();}
enricoan 43:cfc3da0299ff 175
enricoan 19:ebe198368444 176 if (x_mais == 0 && est_x == 1){for(int i = 0; i < 4; i++){eixox = parado[i];wait(t_motor);coord_x += 0;lcd.cls();lcd.printf("Limite de x atingido");}}
enricoan 19:ebe198368444 177 if (y_mais == 0 && est_y == 1){for(int i = 0; i < 4; i++){eixoy = parado[i];wait(t_motor);coord_y += 0;lcd.cls();lcd.printf("Limite de y atingido");}}
amandarm 27:45f8125a0c0b 178 if (z_mais == 0 && est_z == 1){for(int i = 0; i < 4; i++){eixoz = parado[i];wait(t_motor);coord_z += 0;lcd.cls();lcd.printf("Limite de z atingido");}}
amandarm 27:45f8125a0c0b 179
Hiroball 61:be02d7d4e208 180 // while(x_menos == 0){mov_x_menos();
Hiroball 61:be02d7d4e208 181 // lcd.cls(); lcd.printf("X: %4.1f", coord_x);
Hiroball 61:be02d7d4e208 182 // lcd.locate(0,1);lcd.printf("Y: %4.1f", coord_y);
Hiroball 61:be02d7d4e208 183 // lcd.locate(0,2);lcd.printf("Z: %4.1f", coord_z);}
enricoan 32:2a9b30e1e7ab 184
enricoan 33:a513498222c7 185 while(y_menos == 0){mov_y_menos();
enricoan 54:74a215a1f76b 186 lcd.cls(); lcd.printf("X: %4.1f", coord_x);
enricoan 32:2a9b30e1e7ab 187 lcd.locate(0,1);lcd.printf("Y: %4.1f", coord_y);
enricoan 32:2a9b30e1e7ab 188 lcd.locate(0,2);lcd.printf("Z: %4.1f", coord_z);}
enricoan 32:2a9b30e1e7ab 189
enricoan 33:a513498222c7 190 while(z_menos == 0){mov_z_menos();
enricoan 54:74a215a1f76b 191 lcd.cls(); lcd.printf("X: %4.1f", coord_x);
enricoan 32:2a9b30e1e7ab 192 lcd.locate(0,1);lcd.printf("Y: %4.1f", coord_y);
enricoan 32:2a9b30e1e7ab 193 lcd.locate(0,2);lcd.printf("Z: %4.1f", coord_z);}
enricoan 32:2a9b30e1e7ab 194
Hiroball 61:be02d7d4e208 195 // while(x_mais == 0){mov_x_mais();
Hiroball 61:be02d7d4e208 196 // lcd.cls(); lcd.printf("X: %4.1f", coord_x);
Hiroball 61:be02d7d4e208 197 // lcd.locate(0,1);lcd.printf("Y: %4.1f", coord_y);
Hiroball 61:be02d7d4e208 198 // lcd.locate(0,2);lcd.printf("Z: %4.1f", coord_z);}
enricoan 33:a513498222c7 199
enricoan 33:a513498222c7 200 while(y_mais == 0){mov_y_mais();
enricoan 54:74a215a1f76b 201 lcd.cls(); lcd.printf("X: %4.1f", coord_x);
enricoan 33:a513498222c7 202 lcd.locate(0,1);lcd.printf("Y: %4.1f", coord_y);
enricoan 33:a513498222c7 203 lcd.locate(0,2);lcd.printf("Z: %4.1f", coord_z);}
enricoan 33:a513498222c7 204
enricoan 33:a513498222c7 205 while(z_mais == 0){mov_z_mais();
enricoan 54:74a215a1f76b 206 lcd.cls(); lcd.printf("X: %4.1f", coord_x);
enricoan 33:a513498222c7 207 lcd.locate(0,1);lcd.printf("Y: %4.1f", coord_y);
enricoan 33:a513498222c7 208 lcd.locate(0,2);lcd.printf("Z: %4.1f", coord_z);}
enricoan 33:a513498222c7 209
enricoan 33:a513498222c7 210 if(x_mais && x_menos && y_mais && y_menos && z_mais && z_menos != 0){
enricoan 16:70baa0057a76 211 for(int i = 0; i < 4; i++){eixox = parado[i];}
enricoan 16:70baa0057a76 212 for(int i = 0; i < 4; i++){eixoy = parado[i];}
enricoan 33:a513498222c7 213 for(int i = 0; i < 4; i++){eixoz = parado[i];}}
amandarm 35:a8256801e9ab 214
enricoan 43:cfc3da0299ff 215 tecla = pega_tecla();
enricoan 28:c4733814201a 216 if(tecla =='1' && status_tela == "inicio"){
amandarm 26:4123b9462158 217 funcao_pega1();
enricoan 29:76d952358896 218 wait(1);
amandarm 26:4123b9462158 219 funcao_pega2();
enricoan 32:2a9b30e1e7ab 220 status_tela = "novo";}
enricoan 28:c4733814201a 221 else if(tecla == '2' && status_tela == "inicio"){
amandarm 26:4123b9462158 222 funcao_salvo1();
enricoan 29:76d952358896 223 wait(1);
amandarm 26:4123b9462158 224 funcao_salvo2();
enricoan 32:2a9b30e1e7ab 225 status_tela = "salvo";}
amandarm 35:a8256801e9ab 226
enricoan 43:cfc3da0299ff 227 tecla = pega_tecla();
amandarm 35:a8256801e9ab 228 if(tecla =='1' && status_tela =="salvo"){
amandarm 35:a8256801e9ab 229 funcao_salvo_agree1();
amandarm 35:a8256801e9ab 230 wait(1);
amandarm 35:a8256801e9ab 231 funcao_salvo_agree2();
amandarm 35:a8256801e9ab 232 programa = 1;
amandarm 35:a8256801e9ab 233 status_tela = "salvo_confirmacao";}
amandarm 35:a8256801e9ab 234 else if(tecla =='2' && status_tela =="salvo"){
amandarm 35:a8256801e9ab 235 funcao_salvo_agree1();
amandarm 35:a8256801e9ab 236 wait(1);
amandarm 35:a8256801e9ab 237 funcao_salvo_agree2();
amandarm 35:a8256801e9ab 238 programa = 2;
amandarm 35:a8256801e9ab 239 status_tela = "salvo_confirmacao";}
amandarm 35:a8256801e9ab 240 else if(tecla =='3' && status_tela =="salvo"){
amandarm 35:a8256801e9ab 241 funcao_salvo_agree1();
amandarm 35:a8256801e9ab 242 wait(1);
amandarm 35:a8256801e9ab 243 funcao_salvo_agree2();
amandarm 35:a8256801e9ab 244 programa = 3;
amandarm 35:a8256801e9ab 245 status_tela = "salvo_confirmacao";}
amandarm 35:a8256801e9ab 246 else if(tecla =='4' && status_tela =="salvo"){
amandarm 35:a8256801e9ab 247 funcao_salvo_agree1();
amandarm 35:a8256801e9ab 248 wait(1);
amandarm 35:a8256801e9ab 249 funcao_salvo_agree2();
amandarm 35:a8256801e9ab 250 programa = 4;
amandarm 35:a8256801e9ab 251 status_tela = "salvo_confirmacao";}
amandarm 35:a8256801e9ab 252 else if(tecla =='5' && status_tela =="salvo"){
amandarm 35:a8256801e9ab 253 funcao_salvo_agree1();
amandarm 35:a8256801e9ab 254 wait(1);
amandarm 35:a8256801e9ab 255 funcao_salvo_agree2();
amandarm 35:a8256801e9ab 256 programa = 5;
amandarm 35:a8256801e9ab 257 status_tela = "salvo_confirmacao";}
amandarm 44:f0b7a2fe28d9 258 else if(tecla =='6' && status_tela =="salvo"){
amandarm 44:f0b7a2fe28d9 259 funcao_salvo_agree1();
amandarm 44:f0b7a2fe28d9 260 wait(1);
amandarm 44:f0b7a2fe28d9 261 funcao_salvo_agree2();
amandarm 44:f0b7a2fe28d9 262 programa = 6;
amandarm 44:f0b7a2fe28d9 263 status_tela = "salvo_confirmacao";}
amandarm 35:a8256801e9ab 264 else if(tecla =='B' && status_tela =="salvo"){
amandarm 47:0d9c10a9f87d 265 funcao_inicio();
amandarm 35:a8256801e9ab 266 status_tela = "inicio";}
amandarm 35:a8256801e9ab 267
enricoan 43:cfc3da0299ff 268 tecla = pega_tecla();
amandarm 35:a8256801e9ab 269 if(tecla =='1' && status_tela =="salvo_confirmacao"){
amandarm 35:a8256801e9ab 270 funcao_salvo_agree_pos_aviso();
amandarm 44:f0b7a2fe28d9 271 wait(3);
amandarm 36:12c0f6dfb3dc 272 //posicionar no local da pega salvo; (motor -> programa.pos_x_pega e motor -> programa.pos_y_pega)
amandarm 35:a8256801e9ab 273 funcao_salvo_agree_pos_certo();
amandarm 49:4625aaa408fc 274 status_tela="salvo_pos_certo_pega" ;}
amandarm 35:a8256801e9ab 275 else if(tecla =='2' && status_tela =="salvo_confirmacao"){
amandarm 35:a8256801e9ab 276 funcao_salvo_agree_solta_aviso();
amandarm 44:f0b7a2fe28d9 277 wait(3);
amandarm 36:12c0f6dfb3dc 278 //posicionar no local de solta para confirmação; (motor -> programa.pos_x_solta e motor -> programa.pos_y_solta)
amandarm 35:a8256801e9ab 279 funcao_salvo_agree_pos_certo();
amandarm 49:4625aaa408fc 280 status_tela = "salvo_pos_certo_solta";}
amandarm 35:a8256801e9ab 281 else if(tecla =='3' && status_tela =="salvo_confirmacao"){
amandarm 35:a8256801e9ab 282 funcao_salvo_agree_pega_vol();
amandarm 36:12c0f6dfb3dc 283 //programação de volume igual da de cima (programa.vol_pega)
amandarm 52:dca562b09080 284 status_tela="salvo_conf_vol_pega";}
amandarm 35:a8256801e9ab 285 else if(tecla =='4' && status_tela =="salvo_confirmacao"){
amandarm 35:a8256801e9ab 286 funcao_salvo_agree_solta_vol();
amandarm 36:12c0f6dfb3dc 287 //volumes configurados por cada pipeta. (programa.vol_solta_pipeta)
amandarm 35:a8256801e9ab 288 status_tela="salvo_conf_vol_solta";}
amandarm 35:a8256801e9ab 289 else if(tecla =='B' && status_tela =="salvo_confirmacao"){
amandarm 47:0d9c10a9f87d 290 funcao_salvo1();
amandarm 35:a8256801e9ab 291 wait(1);
amandarm 47:0d9c10a9f87d 292 funcao_salvo2();
amandarm 35:a8256801e9ab 293 programa = 1;
amandarm 35:a8256801e9ab 294 status_tela = "salvo";}
amandarm 35:a8256801e9ab 295
enricoan 43:cfc3da0299ff 296 tecla = pega_tecla();
amandarm 49:4625aaa408fc 297 if(tecla =='1' && status_tela =="salvo_pos_certo_pega"){
amandarm 48:135139e2971f 298 funcao_salvo_agree1();
amandarm 52:dca562b09080 299 lcd.locate(18,1);lcd.printf("OK");
amandarm 48:135139e2971f 300 wait(1);
amandarm 48:135139e2971f 301 funcao_salvo_agree2();
enricoan 53:1d0bb62c117f 302 status_tela = "salvo_confirmacao";
amandarm 48:135139e2971f 303 }//salva essa posição como correta
amandarm 49:4625aaa408fc 304 else if(tecla =='2' && status_tela =="salvo_pos_certo_pega"){}
amandarm 49:4625aaa408fc 305 else if(tecla =='B' && status_tela =="salvo_pos_certo_pega"){
amandarm 35:a8256801e9ab 306 funcao_salvo_agree1();
amandarm 35:a8256801e9ab 307 wait(1);
amandarm 35:a8256801e9ab 308 funcao_salvo_agree2();
amandarm 48:135139e2971f 309 status_tela = "salvo_confirmacao";}
amandarm 48:135139e2971f 310
amandarm 52:dca562b09080 311 if(tecla =='A' && status_tela =="salvo_conf_vol_pega"){
amandarm 52:dca562b09080 312 funcao_salvo_agree1();
amandarm 52:dca562b09080 313 wait(1);
amandarm 52:dca562b09080 314 funcao_salvo_agree2();
amandarm 52:dca562b09080 315 lcd.locate(18,1);lcd.printf("OK");
enricoan 53:1d0bb62c117f 316 status_tela = "salvo_confirmacao";
amandarm 52:dca562b09080 317 }//salva essa posição como correta
amandarm 52:dca562b09080 318 else if(tecla =='B' && status_tela =="salvo_conf_vol_pega"){
amandarm 52:dca562b09080 319 funcao_salvo_agree1();
amandarm 52:dca562b09080 320 wait(1);
amandarm 52:dca562b09080 321 funcao_salvo_agree2();
amandarm 52:dca562b09080 322 status_tela = "salvo_confirmacao";}
amandarm 52:dca562b09080 323
amandarm 49:4625aaa408fc 324 if(tecla =='1' && status_tela =="salvo_pos_certo_solta"){
amandarm 49:4625aaa408fc 325 funcao_salvo_agree1();
amandarm 52:dca562b09080 326 lcd.locate(18,2);lcd.printf("OK");
amandarm 49:4625aaa408fc 327 wait(1);
amandarm 49:4625aaa408fc 328 funcao_salvo_agree2();
enricoan 53:1d0bb62c117f 329 status_tela = "salvo_confirmacao";
amandarm 49:4625aaa408fc 330 }//salva essa posição como correta
amandarm 49:4625aaa408fc 331 else if(tecla =='2' && status_tela =="salvo_pos_certo_solta"){}
amandarm 49:4625aaa408fc 332 else if(tecla =='B' && status_tela =="salvo_pos_certo_solta"){
amandarm 49:4625aaa408fc 333 funcao_salvo_agree1();
amandarm 49:4625aaa408fc 334 wait(1);
amandarm 49:4625aaa408fc 335 funcao_salvo_agree2();
amandarm 49:4625aaa408fc 336 status_tela = "salvo_confirmacao";}
amandarm 49:4625aaa408fc 337
amandarm 52:dca562b09080 338 if(tecla =='A' && status_tela =="salvo_conf_vol_solta"){
amandarm 48:135139e2971f 339 funcao_salvo_agree1();
amandarm 48:135139e2971f 340 wait(1);
amandarm 48:135139e2971f 341 funcao_salvo_agree2();
amandarm 52:dca562b09080 342 lcd.locate(18,2);lcd.printf("OK");
enricoan 53:1d0bb62c117f 343 status_tela = "salvo_confirmacao";
amandarm 48:135139e2971f 344 }//salva essa posição como correta
amandarm 48:135139e2971f 345 else if(tecla =='2' && status_tela =="salvo_conf_vol_solta"){}
amandarm 48:135139e2971f 346 else if(tecla =='B' && status_tela =="salvo_conf_vol_solta"){
amandarm 48:135139e2971f 347 funcao_salvo_agree1();
amandarm 48:135139e2971f 348 wait(1);
amandarm 48:135139e2971f 349 funcao_salvo_agree2();
amandarm 35:a8256801e9ab 350 status_tela = "salvo_confirmacao";}
amandarm 35:a8256801e9ab 351
enricoan 43:cfc3da0299ff 352 tecla = pega_tecla();
enricoan 32:2a9b30e1e7ab 353 if(tecla =='1' && status_tela =="novo"){
amandarm 26:4123b9462158 354 funcao_pega_forma();
enricoan 32:2a9b30e1e7ab 355 status_tela ="forma";}
enricoan 53:1d0bb62c117f 356
enricoan 28:c4733814201a 357 else if(tecla =='2' && status_tela == "novo"){
enricoan 54:74a215a1f76b 358 volume = 0;
enricoan 54:74a215a1f76b 359 printf("\n%c",pega_tecla());
enricoan 53:1d0bb62c117f 360 funcao_pega_volume(); //!!!!!!!!!!!!!!!!!!!!!!!!!!!WTFFFFF
Hiroball 34:1b5a00c55376 361 status_tela = "volume";
enricoan 54:74a215a1f76b 362 continuar = 1;
enricoan 54:74a215a1f76b 363 multiplicador = 10;
enricoan 54:74a215a1f76b 364 while(continuar){
enricoan 54:74a215a1f76b 365 printf("\n%c",pega_tecla());
enricoan 43:cfc3da0299ff 366 tecla = pega_tecla();
Hiroball 61:be02d7d4e208 367 lcd.locate(6,1);
enricoan 54:74a215a1f76b 368 wait(1);
enricoan 54:74a215a1f76b 369 if(tecla!= 'A' && tecla!='B' && tecla!= 'k'){
Hiroball 61:be02d7d4e208 370 volume = multiplicador*volume + ((int)tecla-48);
Hiroball 61:be02d7d4e208 371 lcd.printf("%c", tecla);
Hiroball 34:1b5a00c55376 372 }
Hiroball 59:447534f1e4f5 373 else if(tecla == 'A'){
enricoan 53:1d0bb62c117f 374 lcd.locate(0,2);
Hiroball 61:be02d7d4e208 375 printf("Volume inputado!");
Hiroball 34:1b5a00c55376 376 continuar = 0;
enricoan 54:74a215a1f76b 377 wait(1);
Hiroball 34:1b5a00c55376 378 }
Hiroball 59:447534f1e4f5 379 else if(tecla=='B'){
Hiroball 59:447534f1e4f5 380 funcao_pega1();
Hiroball 59:447534f1e4f5 381 wait(1);
Hiroball 59:447534f1e4f5 382 funcao_pega2();
Hiroball 59:447534f1e4f5 383 status_tela = "novo";
Hiroball 61:be02d7d4e208 384 continuar = 0;
Hiroball 61:be02d7d4e208 385 }
Hiroball 34:1b5a00c55376 386 }
Hiroball 34:1b5a00c55376 387 }
enricoan 28:c4733814201a 388 else if(tecla == '3' && status_tela == "novo"){
amandarm 26:4123b9462158 389 funcao_pega_pos_x();
amandarm 55:4d071fb49f24 390 pos_x_pega = 12.5;
enricoan 32:2a9b30e1e7ab 391 status_tela = "pos_x";}
enricoan 28:c4733814201a 392 else if(tecla == 'B' && status_tela == "novo"){
amandarm 26:4123b9462158 393 funcao_inicio();
enricoan 32:2a9b30e1e7ab 394 status_tela = "inicio";}
enricoan 28:c4733814201a 395 else if(tecla == '1' && status_tela == "salvo"){
amandarm 26:4123b9462158 396 funcao_salvo_agree1();
enricoan 32:2a9b30e1e7ab 397 status_tela = "confirmacao";}
enricoan 28:c4733814201a 398 else if(tecla =='2' && status_tela == "salvo"){
amandarm 26:4123b9462158 399 funcao_salvo_agree1();
enricoan 32:2a9b30e1e7ab 400 status_tela = "confirmacao";}
enricoan 28:c4733814201a 401 else if(tecla =='B' && status_tela == "salvo"){
amandarm 26:4123b9462158 402 funcao_inicio();
enricoan 32:2a9b30e1e7ab 403 status_tela = "inicio";}
amandarm 35:a8256801e9ab 404
enricoan 56:e748b9bd5e3c 405 tecla = 'F';
enricoan 56:e748b9bd5e3c 406 wait(1);
enricoan 43:cfc3da0299ff 407 tecla = pega_tecla();
enricoan 28:c4733814201a 408 if(tecla == '1' && status_tela == "forma"){
amandarm 26:4123b9462158 409 funcao_pega_forma_quad();
amandarm 55:4d071fb49f24 410 tipo_pega = 1;
Hiroball 59:447534f1e4f5 411 tecla = pega_tecla();
Hiroball 59:447534f1e4f5 412 wait(1);
Hiroball 61:be02d7d4e208 413 status_tela ="forma_quad";
Hiroball 59:447534f1e4f5 414 continuar = 1;
Hiroball 59:447534f1e4f5 415 comprimento_quad = 0;
Hiroball 59:447534f1e4f5 416 while(continuar){
Hiroball 59:447534f1e4f5 417 printf("\n%c",pega_tecla());
Hiroball 59:447534f1e4f5 418 tecla = pega_tecla();
Hiroball 59:447534f1e4f5 419 wait(1);
Hiroball 61:be02d7d4e208 420 lcd.locate(0,2);
Hiroball 59:447534f1e4f5 421 if(tecla!= 'A' && tecla!='B' && tecla!= 'k'){
enricoan 60:e2c632e8dee1 422 comprimento_quad = multiplicador*comprimento_quad + ((int)tecla - 48);
Hiroball 61:be02d7d4e208 423 lcd.printf("%c",tecla);
Hiroball 59:447534f1e4f5 424 }
Hiroball 59:447534f1e4f5 425 else if(tecla == 'A'){
Hiroball 59:447534f1e4f5 426 continuar = 0;
Hiroball 61:be02d7d4e208 427 printf("Comprimento inputado!");
Hiroball 61:be02d7d4e208 428 printf("\nComprimento: %d", comprimento_quad);
Hiroball 59:447534f1e4f5 429 }
Hiroball 59:447534f1e4f5 430 else if(tecla=='B'){
Hiroball 59:447534f1e4f5 431 funcao_pega_forma();
Hiroball 59:447534f1e4f5 432 status_tela = "forma";
Hiroball 59:447534f1e4f5 433 continuar = 0;}
Hiroball 59:447534f1e4f5 434 }
Hiroball 59:447534f1e4f5 435 }
enricoan 28:c4733814201a 436 else if(tecla == '2' && status_tela == "forma"){
amandarm 26:4123b9462158 437 funcao_pega_forma_red();
enricoan 56:e748b9bd5e3c 438 tipo_pega = 2;
Hiroball 61:be02d7d4e208 439 tecla = pega_tecla();
Hiroball 61:be02d7d4e208 440 wait(1);
Hiroball 61:be02d7d4e208 441 continuar = 1;
Hiroball 61:be02d7d4e208 442 diametro = 0;
Hiroball 61:be02d7d4e208 443 status_tela = "forma_red";
Hiroball 61:be02d7d4e208 444 while(continuar){
Hiroball 61:be02d7d4e208 445 tecla = pega_tecla();
Hiroball 61:be02d7d4e208 446 wait(1);
Hiroball 61:be02d7d4e208 447 lcd.locate(0,2);
Hiroball 61:be02d7d4e208 448 if(tecla!= 'A' && tecla!='B' && tecla!= 'k'){
Hiroball 61:be02d7d4e208 449 diametro = multiplicador*diametro + ((int)tecla - 48);
Hiroball 61:be02d7d4e208 450 lcd.printf("%c",tecla);
Hiroball 61:be02d7d4e208 451 }
Hiroball 61:be02d7d4e208 452 else if(tecla == 'A'){
Hiroball 61:be02d7d4e208 453 continuar = 0;
Hiroball 61:be02d7d4e208 454 printf("Diametro inputado!");
Hiroball 61:be02d7d4e208 455 printf("Diametro: %d", diametro);
Hiroball 61:be02d7d4e208 456 }
Hiroball 61:be02d7d4e208 457 else if(tecla=='B'){
Hiroball 61:be02d7d4e208 458 funcao_pega_forma();
Hiroball 61:be02d7d4e208 459 status_tela = "forma";
Hiroball 61:be02d7d4e208 460 continuar = 0;}
Hiroball 61:be02d7d4e208 461 }
Hiroball 61:be02d7d4e208 462 }
enricoan 28:c4733814201a 463 else if(tecla == 'B' && status_tela == "forma"){
enricoan 56:e748b9bd5e3c 464 funcao_pega1();
enricoan 56:e748b9bd5e3c 465 wait(1);
enricoan 56:e748b9bd5e3c 466 funcao_pega2();
enricoan 32:2a9b30e1e7ab 467 status_tela = "novo";}
amandarm 35:a8256801e9ab 468
enricoan 43:cfc3da0299ff 469 tecla = pega_tecla();
enricoan 28:c4733814201a 470 if(tecla == 'A' && status_tela == "forma_quad"){
amandarm 26:4123b9462158 471 funcao_pega1();
amandarm 55:4d071fb49f24 472 medida_lado_pega = 10;
enricoan 58:d573b618f45a 473 if(pos_y_pega !=0){
enricoan 58:d573b618f45a 474 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 475 }
enricoan 58:d573b618f45a 476 if(medida_lado_pega !=0){
enricoan 58:d573b618f45a 477 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 478 }
enricoan 29:76d952358896 479 wait(1);
amandarm 26:4123b9462158 480 funcao_pega2();
enricoan 58:d573b618f45a 481 if(volume_pega !=0){
enricoan 58:d573b618f45a 482 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 483 }
enricoan 56:e748b9bd5e3c 484 status_tela ="novo";}
enricoan 28:c4733814201a 485 else if(tecla == 'B' && status_tela == "forma_quad"){
amandarm 26:4123b9462158 486 funcao_pega_forma();
enricoan 32:2a9b30e1e7ab 487 status_tela = "forma";}
enricoan 28:c4733814201a 488 else if(tecla == 'A' && status_tela == "forma_red"){
amandarm 55:4d071fb49f24 489 medida_lado_pega = 10;
amandarm 26:4123b9462158 490 funcao_pega1();
enricoan 58:d573b618f45a 491 if(pos_y_pega !=0){
enricoan 58:d573b618f45a 492 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 493 }
enricoan 58:d573b618f45a 494 if(medida_lado_pega !=0){
enricoan 58:d573b618f45a 495 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 496 }
enricoan 29:76d952358896 497 wait(1);
amandarm 26:4123b9462158 498 funcao_pega2();
enricoan 58:d573b618f45a 499 if(volume_pega !=0){
enricoan 58:d573b618f45a 500 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 501 }
enricoan 56:e748b9bd5e3c 502 status_tela ="novo";}
enricoan 28:c4733814201a 503 else if(tecla == 'B' && status_tela == "forma_red"){
amandarm 26:4123b9462158 504 funcao_pega_forma();
enricoan 32:2a9b30e1e7ab 505 status_tela = "forma";}
enricoan 28:c4733814201a 506 else if(tecla == 'A' && status_tela == "volume"){
amandarm 26:4123b9462158 507 funcao_pega1();
amandarm 55:4d071fb49f24 508 volume_pega = 12;
enricoan 58:d573b618f45a 509 if(pos_y_pega !=0){
enricoan 58:d573b618f45a 510 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 511 }
enricoan 58:d573b618f45a 512 if(medida_lado_pega !=0){
enricoan 58:d573b618f45a 513 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 514 }
enricoan 29:76d952358896 515 wait(1);
amandarm 26:4123b9462158 516 funcao_pega2();
enricoan 58:d573b618f45a 517 if(volume_pega !=0){
enricoan 58:d573b618f45a 518 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 519 }
enricoan 56:e748b9bd5e3c 520 status_tela ="novo";}
enricoan 28:c4733814201a 521 else if( tecla == 'B' && status_tela == "volume"){
amandarm 26:4123b9462158 522 funcao_pega_forma();
enricoan 32:2a9b30e1e7ab 523 status_tela = "forma";}
enricoan 28:c4733814201a 524 else if(tecla == 'A' && status_tela == "pos_x"){
enricoan 29:76d952358896 525 funcao_pega_pos_y(); //colocar programacao que contem o posicionamento do eixo y
amandarm 55:4d071fb49f24 526 pos_y_pega = 12.5;
enricoan 32:2a9b30e1e7ab 527 status_tela = "pos_y";}
enricoan 28:c4733814201a 528 else if(tecla == 'B' && status_tela == "pos_x"){
amandarm 26:4123b9462158 529 funcao_pega_forma();
enricoan 32:2a9b30e1e7ab 530 status_tela = "forma";}
amandarm 35:a8256801e9ab 531
enricoan 43:cfc3da0299ff 532 tecla = pega_tecla();
enricoan 28:c4733814201a 533 if(tecla == 'A' && status_tela == "pos_y"){
amandarm 26:4123b9462158 534 funcao_pega1();
enricoan 58:d573b618f45a 535 if(pos_y_pega !=0){
enricoan 58:d573b618f45a 536 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 537 }
enricoan 58:d573b618f45a 538 if(medida_lado_pega !=0){
enricoan 58:d573b618f45a 539 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 540 }
enricoan 29:76d952358896 541 wait(1);
amandarm 26:4123b9462158 542 funcao_pega2();
enricoan 58:d573b618f45a 543 if(volume_pega !=0){
enricoan 58:d573b618f45a 544 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 545 }
enricoan 56:e748b9bd5e3c 546 wait(1);
enricoan 56:e748b9bd5e3c 547 status_tela ="novo";}
enricoan 28:c4733814201a 548 else if(tecla == 'B' && status_tela == "pos_y"){
amandarm 26:4123b9462158 549 funcao_pega_forma();
enricoan 32:2a9b30e1e7ab 550 status_tela = "forma";}
amandarm 55:4d071fb49f24 551
amandarm 55:4d071fb49f24 552
amandarm 55:4d071fb49f24 553 tecla=pega_tecla();
enricoan 56:e748b9bd5e3c 554 if(pos_x_pega!=0 && pos_y_pega!=0 && medida_lado_pega!=0 && volume_pega !=0 && tipo_pega!=0 && status_tela == "novo"){
amandarm 55:4d071fb49f24 555 funcao_solta1();
amandarm 55:4d071fb49f24 556 wait(3);
amandarm 55:4d071fb49f24 557 funcao_solta2();
enricoan 58:d573b618f45a 558 if(volume_solta_9 !=0){
enricoan 58:d573b618f45a 559 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 560 }
amandarm 55:4d071fb49f24 561 wait(3);
enricoan 56:e748b9bd5e3c 562 status_tela="solta";}
amandarm 55:4d071fb49f24 563
amandarm 55:4d071fb49f24 564 tecla=pega_tecla();
amandarm 55:4d071fb49f24 565 if(tecla == '1' && status_tela == "solta"){
amandarm 55:4d071fb49f24 566 funcao_solta_dimensao();
Hiroball 61:be02d7d4e208 567 continuar = 1;
Hiroball 61:be02d7d4e208 568 diametro_solta = 0;
amandarm 55:4d071fb49f24 569 status_tela="solta_dimensao";
Hiroball 61:be02d7d4e208 570 lcd.locate(0,2);
Hiroball 61:be02d7d4e208 571 while(continuar){
Hiroball 61:be02d7d4e208 572 tecla = pega_tecla();
Hiroball 61:be02d7d4e208 573 wait(1);
Hiroball 61:be02d7d4e208 574 if(tecla!= 'A' && tecla!='B' && tecla!= 'k'){
Hiroball 61:be02d7d4e208 575 diametro_solta = multiplicador*diametro_solta + ((int)tecla - 48);
Hiroball 61:be02d7d4e208 576 lcd.printf("%c",tecla);
Hiroball 61:be02d7d4e208 577 }
Hiroball 61:be02d7d4e208 578 else if(tecla == 'A'){
Hiroball 61:be02d7d4e208 579 printf("Diametro do solta inputado!");
Hiroball 61:be02d7d4e208 580 printf("Diametro do solta: %d", diametro_solta);
Hiroball 61:be02d7d4e208 581 continuar = 0;
Hiroball 61:be02d7d4e208 582 }
Hiroball 61:be02d7d4e208 583 else if(tecla=='B'){
Hiroball 61:be02d7d4e208 584 funcao_pega_forma();
Hiroball 61:be02d7d4e208 585 status_tela = "solta";
Hiroball 61:be02d7d4e208 586 funcao_solta1();
Hiroball 61:be02d7d4e208 587 wait(3);
Hiroball 61:be02d7d4e208 588 funcao_solta2();
Hiroball 61:be02d7d4e208 589 continuar = 0;}
Hiroball 61:be02d7d4e208 590 }
Hiroball 61:be02d7d4e208 591 }
Hiroball 61:be02d7d4e208 592
amandarm 55:4d071fb49f24 593 else if(tecla == '2' && status_tela == "solta"){
amandarm 55:4d071fb49f24 594 funcao_solta_vol();
Hiroball 61:be02d7d4e208 595 volume_solta = 0;
Hiroball 61:be02d7d4e208 596 continuar = 1;
amandarm 55:4d071fb49f24 597 status_tela="solta_vol";
Hiroball 61:be02d7d4e208 598 lcd.locate(0,2);
Hiroball 61:be02d7d4e208 599 while(continuar){
Hiroball 61:be02d7d4e208 600 tecla = pega_tecla();
Hiroball 61:be02d7d4e208 601 wait(1);
Hiroball 61:be02d7d4e208 602 if(tecla!= 'A' && tecla!='B' && tecla!= 'k'){
Hiroball 61:be02d7d4e208 603 volume_solta = multiplicador*volume_solta + ((int)tecla - 48);
Hiroball 61:be02d7d4e208 604 lcd.printf("%c",tecla);
Hiroball 61:be02d7d4e208 605 }
Hiroball 61:be02d7d4e208 606 else if(tecla == 'A'){
Hiroball 61:be02d7d4e208 607 printf("Volume solta inputado!");
Hiroball 61:be02d7d4e208 608 printf("Volume: %d", volume_solta);
Hiroball 61:be02d7d4e208 609 continuar = 0;
Hiroball 61:be02d7d4e208 610 }
Hiroball 61:be02d7d4e208 611 else if(tecla=='B'){
Hiroball 61:be02d7d4e208 612 funcao_pega_forma();
Hiroball 61:be02d7d4e208 613 status_tela = "solta";
Hiroball 61:be02d7d4e208 614 continuar = 0;
Hiroball 61:be02d7d4e208 615 funcao_solta1();
Hiroball 61:be02d7d4e208 616 wait(3);
Hiroball 61:be02d7d4e208 617 funcao_solta2();
Hiroball 61:be02d7d4e208 618 }
Hiroball 61:be02d7d4e208 619 }
amandarm 55:4d071fb49f24 620 }
amandarm 55:4d071fb49f24 621 else if(tecla == '3' && status_tela == "solta"){
amandarm 55:4d071fb49f24 622 funcao_solta_pos_x();
amandarm 55:4d071fb49f24 623 status_tela="solta_pos_x";
Hiroball 61:be02d7d4e208 624 continuar = 1;
Hiroball 61:be02d7d4e208 625 while(continuar){
Hiroball 61:be02d7d4e208 626 while(x_menos == 0){mov_x_menos();
Hiroball 61:be02d7d4e208 627 lcd.cls();
Hiroball 61:be02d7d4e208 628 lcd.printf("X: %4.1f", coord_x);}
Hiroball 61:be02d7d4e208 629 while(x_mais == 0){mov_x_mais();
Hiroball 61:be02d7d4e208 630 lcd.cls();
Hiroball 61:be02d7d4e208 631 lcd.printf("X: %4.1f", coord_x);}
Hiroball 61:be02d7d4e208 632 if(tecla=='A'){
Hiroball 61:be02d7d4e208 633 continuar = 0;
Hiroball 61:be02d7d4e208 634 printf("Posicao de x salva!");
Hiroball 61:be02d7d4e208 635 printf("Posicao X: %4.1f", coord_x);
Hiroball 61:be02d7d4e208 636 }
amandarm 55:4d071fb49f24 637 }
Hiroball 61:be02d7d4e208 638 }
amandarm 55:4d071fb49f24 639 else if(tecla == 'B' && status_tela == "solta"){
amandarm 55:4d071fb49f24 640 funcao_pega1();
enricoan 58:d573b618f45a 641 if(pos_y_pega !=0){
enricoan 58:d573b618f45a 642 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 643 }
enricoan 58:d573b618f45a 644 if(medida_lado_pega !=0){
enricoan 58:d573b618f45a 645 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 646 }
amandarm 55:4d071fb49f24 647 wait(1);
amandarm 55:4d071fb49f24 648 funcao_pega2();
enricoan 58:d573b618f45a 649 if(volume_pega !=0){
enricoan 58:d573b618f45a 650 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 651 }
amandarm 55:4d071fb49f24 652 status_tela="inicio";
amandarm 55:4d071fb49f24 653 }
amandarm 55:4d071fb49f24 654
amandarm 55:4d071fb49f24 655 tecla=pega_tecla();
amandarm 55:4d071fb49f24 656 if(tecla=='A' && status_tela=="solta_dimensao"){
amandarm 55:4d071fb49f24 657 dimensao_solta = 10;
amandarm 55:4d071fb49f24 658 funcao_solta1();
enricoan 58:d573b618f45a 659 if(pos_y_solta !=0){
enricoan 58:d573b618f45a 660 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 661 }
enricoan 58:d573b618f45a 662 if(dimensao_solta !=0){
enricoan 58:d573b618f45a 663 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 664 }
amandarm 55:4d071fb49f24 665 wait(3);
amandarm 55:4d071fb49f24 666 funcao_solta2();
enricoan 58:d573b618f45a 667 if(volume_solta_9 !=0){
enricoan 58:d573b618f45a 668 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 669 }
amandarm 55:4d071fb49f24 670 wait(3);
amandarm 55:4d071fb49f24 671 status_tela="solta";
amandarm 55:4d071fb49f24 672 }
amandarm 55:4d071fb49f24 673 else if(tecla=='B' && status_tela=="solta_dimensao"){
amandarm 55:4d071fb49f24 674 funcao_solta1();
enricoan 58:d573b618f45a 675 if(pos_y_solta !=0){
enricoan 58:d573b618f45a 676 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 677 }
enricoan 58:d573b618f45a 678 if(dimensao_solta !=0){
enricoan 58:d573b618f45a 679 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 680 }
amandarm 55:4d071fb49f24 681 wait(3);
amandarm 55:4d071fb49f24 682 funcao_solta2();
enricoan 58:d573b618f45a 683 if(volume_solta_9 !=0){
enricoan 58:d573b618f45a 684 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 685 }
amandarm 55:4d071fb49f24 686 wait(3);
amandarm 55:4d071fb49f24 687 status_tela="solta";
amandarm 55:4d071fb49f24 688 }
amandarm 55:4d071fb49f24 689 if(tecla=='1' && status_tela=="solta_vol"){
amandarm 55:4d071fb49f24 690 funcao_solta_vol_igual();
amandarm 55:4d071fb49f24 691 status_tela="solta_vol_igual";
amandarm 55:4d071fb49f24 692 }
amandarm 55:4d071fb49f24 693 else if(tecla=='2' && status_tela=="solta_vol"){
amandarm 55:4d071fb49f24 694 funcao_solta_vol_cada();
amandarm 55:4d071fb49f24 695 status_tela="solta_vol_dif";
amandarm 55:4d071fb49f24 696 }
amandarm 55:4d071fb49f24 697 else if(tecla=='B' && status_tela=="solta_vol"){
amandarm 55:4d071fb49f24 698 funcao_solta1();
enricoan 58:d573b618f45a 699 if(pos_y_solta !=0){
enricoan 58:d573b618f45a 700 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 701 }
enricoan 58:d573b618f45a 702 if(dimensao_solta !=0){
enricoan 58:d573b618f45a 703 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 704 }
amandarm 55:4d071fb49f24 705 wait(3);
amandarm 55:4d071fb49f24 706 funcao_solta2();
enricoan 58:d573b618f45a 707 if(volume_solta_9 !=0){
enricoan 58:d573b618f45a 708 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 709 }
amandarm 55:4d071fb49f24 710 wait(3);
amandarm 55:4d071fb49f24 711 status_tela="solta";
amandarm 55:4d071fb49f24 712 }
enricoan 56:e748b9bd5e3c 713 if(tecla=='A' && status_tela=="solta_pos_x"){
amandarm 55:4d071fb49f24 714 funcao_solta_pos_y();
amandarm 55:4d071fb49f24 715 pos_x_solta = 10;
enricoan 56:e748b9bd5e3c 716 status_tela="solta_pos_y";
amandarm 55:4d071fb49f24 717 }
enricoan 56:e748b9bd5e3c 718 else if(tecla=='B' && status_tela=="solta_pos_x"){
amandarm 55:4d071fb49f24 719 funcao_solta1();
enricoan 58:d573b618f45a 720 if(pos_y_solta !=0){
enricoan 58:d573b618f45a 721 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 722 }
enricoan 58:d573b618f45a 723 if(dimensao_solta !=0){
enricoan 58:d573b618f45a 724 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 725 }
amandarm 55:4d071fb49f24 726 wait(3);
amandarm 55:4d071fb49f24 727 funcao_solta2();
enricoan 58:d573b618f45a 728 if(volume_solta_9 !=0){
enricoan 58:d573b618f45a 729 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 730 }
amandarm 55:4d071fb49f24 731 wait(3);
amandarm 55:4d071fb49f24 732 status_tela="solta";
amandarm 55:4d071fb49f24 733 }
amandarm 55:4d071fb49f24 734
amandarm 55:4d071fb49f24 735 tecla=pega_tecla();
amandarm 55:4d071fb49f24 736 if(tecla=='A' && status_tela=="solta_vol_igual"){
amandarm 55:4d071fb49f24 737 volume_solta_1=10;
amandarm 55:4d071fb49f24 738 volume_solta_2=10;
amandarm 55:4d071fb49f24 739 volume_solta_3=10;
amandarm 55:4d071fb49f24 740 volume_solta_4=10;
amandarm 55:4d071fb49f24 741 volume_solta_5=10;
amandarm 55:4d071fb49f24 742 volume_solta_6=10;
amandarm 55:4d071fb49f24 743 volume_solta_7=10;
amandarm 55:4d071fb49f24 744 volume_solta_8=10;
amandarm 55:4d071fb49f24 745 volume_solta_9=10;
amandarm 55:4d071fb49f24 746
amandarm 55:4d071fb49f24 747 funcao_solta1();
enricoan 58:d573b618f45a 748 if(pos_y_solta !=0){
enricoan 58:d573b618f45a 749 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 750 }
enricoan 58:d573b618f45a 751 if(dimensao_solta !=0){
enricoan 58:d573b618f45a 752 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 753 }
amandarm 55:4d071fb49f24 754 wait(3);
amandarm 55:4d071fb49f24 755 funcao_solta2();
enricoan 58:d573b618f45a 756 if(volume_solta_9 !=0){
enricoan 58:d573b618f45a 757 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 758 }
amandarm 55:4d071fb49f24 759 wait(3);
enricoan 56:e748b9bd5e3c 760 status_tela="solta";}
amandarm 55:4d071fb49f24 761 else if(tecla=='B' && status_tela=="solta_vol_igual"){
amandarm 55:4d071fb49f24 762 funcao_solta_vol();
amandarm 55:4d071fb49f24 763 status_tela="solta_vol";
amandarm 55:4d071fb49f24 764 }
amandarm 55:4d071fb49f24 765 if(tecla=='1' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 766 volume_solta_1=10;
enricoan 56:e748b9bd5e3c 767 lcd.locate(12,0);lcd.printf("10");
amandarm 55:4d071fb49f24 768 }
amandarm 55:4d071fb49f24 769 if(tecla=='2' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 770 volume_solta_2=20;
enricoan 56:e748b9bd5e3c 771 lcd.locate(15,0);lcd.printf("20");
amandarm 55:4d071fb49f24 772 }
amandarm 55:4d071fb49f24 773 if(tecla=='3' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 774 volume_solta_3=30;
enricoan 56:e748b9bd5e3c 775 lcd.locate(18,0);lcd.printf("30");
amandarm 55:4d071fb49f24 776 }
amandarm 55:4d071fb49f24 777 if(tecla=='4' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 778 volume_solta_4=40;
enricoan 56:e748b9bd5e3c 779 lcd.locate(12,1);lcd.printf("40");
amandarm 55:4d071fb49f24 780 }
amandarm 55:4d071fb49f24 781 if(tecla=='5' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 782 volume_solta_5=50;
enricoan 56:e748b9bd5e3c 783 lcd.locate(15,1);lcd.printf("50");
amandarm 55:4d071fb49f24 784 }
amandarm 55:4d071fb49f24 785 if(tecla=='6' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 786 volume_solta_6=60;
enricoan 56:e748b9bd5e3c 787 lcd.locate(18,1);lcd.printf("60");
amandarm 55:4d071fb49f24 788 }
amandarm 55:4d071fb49f24 789 if(tecla=='7' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 790 volume_solta_7=70;
enricoan 56:e748b9bd5e3c 791 lcd.locate(12,2);lcd.printf("70");
amandarm 55:4d071fb49f24 792 }
amandarm 55:4d071fb49f24 793 if(tecla=='8' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 794 volume_solta_8=80;
enricoan 56:e748b9bd5e3c 795 lcd.locate(15,2);lcd.printf("80");
amandarm 55:4d071fb49f24 796 }
amandarm 55:4d071fb49f24 797 if(tecla=='9' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 798 volume_solta_9=90;
enricoan 56:e748b9bd5e3c 799 lcd.locate(18,2);lcd.printf("90");
amandarm 55:4d071fb49f24 800 }
amandarm 55:4d071fb49f24 801 if(tecla=='A' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 802 funcao_solta1();
enricoan 58:d573b618f45a 803 if(pos_y_solta !=0){
enricoan 58:d573b618f45a 804 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 805 }
enricoan 58:d573b618f45a 806 if(dimensao_solta !=0){
enricoan 58:d573b618f45a 807 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 808 }
amandarm 55:4d071fb49f24 809 wait(3);
amandarm 55:4d071fb49f24 810 funcao_solta2();
enricoan 58:d573b618f45a 811 if(volume_solta_9 !=0){
enricoan 58:d573b618f45a 812 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 813 }
amandarm 55:4d071fb49f24 814 wait(3);
amandarm 55:4d071fb49f24 815 status_tela="solta";
amandarm 55:4d071fb49f24 816 }
amandarm 55:4d071fb49f24 817 else if(tecla=='B' && status_tela=="solta_vol_dif"){
amandarm 55:4d071fb49f24 818 funcao_solta_vol();
amandarm 55:4d071fb49f24 819 status_tela="solta_vol";
amandarm 55:4d071fb49f24 820 }
enricoan 56:e748b9bd5e3c 821 if(tecla=='A' && status_tela=="solta_pos_y"){
amandarm 55:4d071fb49f24 822 funcao_solta1();
enricoan 58:d573b618f45a 823 if(pos_y_solta !=0){
enricoan 58:d573b618f45a 824 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 825 }
enricoan 58:d573b618f45a 826 if(dimensao_solta !=0){
enricoan 58:d573b618f45a 827 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 828 }
amandarm 55:4d071fb49f24 829 wait(3);
amandarm 55:4d071fb49f24 830 funcao_solta2();
enricoan 58:d573b618f45a 831 if(volume_solta_9 !=0){
enricoan 58:d573b618f45a 832 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 833 }
amandarm 55:4d071fb49f24 834 pos_y_solta = 10;
amandarm 55:4d071fb49f24 835 wait(3);
amandarm 55:4d071fb49f24 836 status_tela="solta";
amandarm 55:4d071fb49f24 837 }
enricoan 56:e748b9bd5e3c 838 else if(tecla=='B' && status_tela=="solta_pos_y"){
amandarm 55:4d071fb49f24 839 funcao_solta1();
enricoan 58:d573b618f45a 840 if(pos_y_solta !=0){
enricoan 58:d573b618f45a 841 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 842 }
enricoan 58:d573b618f45a 843 if(dimensao_solta !=0){
enricoan 58:d573b618f45a 844 lcd.locate(18,1);lcd.printf("OK");
enricoan 58:d573b618f45a 845 }
amandarm 55:4d071fb49f24 846 wait(3);
amandarm 55:4d071fb49f24 847 funcao_solta2();
enricoan 58:d573b618f45a 848 if(volume_solta_9 !=0){
enricoan 58:d573b618f45a 849 lcd.locate(18,0);lcd.printf("OK");
enricoan 58:d573b618f45a 850 }
amandarm 55:4d071fb49f24 851 pos_y_solta = 10;
amandarm 55:4d071fb49f24 852 wait(3);
amandarm 55:4d071fb49f24 853 status_tela="solta";
amandarm 55:4d071fb49f24 854 }
amandarm 55:4d071fb49f24 855
amandarm 55:4d071fb49f24 856 if(pos_x_solta!=0 && pos_y_solta!=0 && volume_solta_9!=0 && dimensao_solta!=0 && status_tela=="solta"){
amandarm 55:4d071fb49f24 857 funcao_acomp();
amandarm 55:4d071fb49f24 858 status_tela="acompanhamento";
amandarm 55:4d071fb49f24 859 };
amandarm 55:4d071fb49f24 860 }
enricoan 10:4f49e9859535 861 }