Projeto Mecatrônico
/
ProjetoMecatronico
testando
main_PM.cpp@11:dc557e461dfd, 2020-05-25 (annotated)
- Committer:
- Hiroball
- Date:
- Mon May 25 16:05:21 2020 +0000
- Revision:
- 11:dc557e461dfd
- Parent:
- 10:4f49e9859535
- Child:
- 12:976d42656c4c
DigitalOut-->BusOut;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
enricoan | 10:4f49e9859535 | 1 | #include "mbed.h" |
enricoan | 10:4f49e9859535 | 2 | #include "TextLCD.h" |
enricoan | 10:4f49e9859535 | 3 | #include "Keypad.h" |
enricoan | 10:4f49e9859535 | 4 | |
enricoan | 10:4f49e9859535 | 5 | //local para a declaração de pinos e variáveis |
enricoan | 10:4f49e9859535 | 6 | float t_motor = 0.008; |
enricoan | 10:4f49e9859535 | 7 | float t_teclado = 0.01; |
Hiroball | 11:dc557e461dfd | 8 | int horario[] = {12,6,3,9}; |
Hiroball | 11:dc557e461dfd | 9 | int antih[] = {3,6,12,9}; |
Hiroball | 11:dc557e461dfd | 10 | |
enricoan | 10:4f49e9859535 | 11 | //botões para movimentação eixo a eixo |
enricoan | 10:4f49e9859535 | 12 | DigitalIn x_mais(PA_0); |
enricoan | 10:4f49e9859535 | 13 | DigitalIn x_menos(PA_1); |
enricoan | 10:4f49e9859535 | 14 | DigitalIn y_mais(PC_0); |
enricoan | 10:4f49e9859535 | 15 | DigitalIn y_menos(PC_1); |
enricoan | 10:4f49e9859535 | 16 | DigitalIn z_mais(PC_2); |
enricoan | 10:4f49e9859535 | 17 | DigitalIn z_menos(PC_3); |
enricoan | 10:4f49e9859535 | 18 | |
enricoan | 10:4f49e9859535 | 19 | //pinos da placa usados na biblioteca do LCD |
enricoan | 10:4f49e9859535 | 20 | TextLCD lcd(D4, D5, D6, D7, D8, D9); |
enricoan | 10:4f49e9859535 | 21 | |
enricoan | 10:4f49e9859535 | 22 | //pinos de saída para os motores |
enricoan | 10:4f49e9859535 | 23 | //eixo x |
Hiroball | 11:dc557e461dfd | 24 | BusOut eixox(PA_15,PA_14,PA_13,PA_12); |
Hiroball | 11:dc557e461dfd | 25 | |
enricoan | 10:4f49e9859535 | 26 | //eixo y |
Hiroball | 11:dc557e461dfd | 27 | BusOut eixoy(PA_11,PA_10,PB_2,PB_1); |
Hiroball | 11:dc557e461dfd | 28 | |
enricoan | 10:4f49e9859535 | 29 | //eixo z |
Hiroball | 11:dc557e461dfd | 30 | BusOut eixoz(PC_9,PC_8,PB_8,PC_6); |
enricoan | 10:4f49e9859535 | 31 | |
enricoan | 10:4f49e9859535 | 32 | int main() { |
Hiroball | 11:dc557e461dfd | 33 | lcd.printf(" Bem-vindo "); |
Hiroball | 11:dc557e461dfd | 34 | lcd.locate(0,1); |
Hiroball | 11:dc557e461dfd | 35 | lcd.printf(" ao Pipemax "); |
Hiroball | 11:dc557e461dfd | 36 | lcd.locate(0,2); |
Hiroball | 11:dc557e461dfd | 37 | lcd.printf("o seu sistema automatizado"); |
Hiroball | 11:dc557e461dfd | 38 | lcd.locate(0,3); |
Hiroball | 11:dc557e461dfd | 39 | lcd.printf(" de pipetagem"); |
Hiroball | 11:dc557e461dfd | 40 | |
Hiroball | 11:dc557e461dfd | 41 | while(1) { |
Hiroball | 11:dc557e461dfd | 42 | if (x_mais == 0){ |
Hiroball | 11:dc557e461dfd | 43 | for(int i = 0; i < 4; i++){ |
Hiroball | 11:dc557e461dfd | 44 | eixox = horario[i]; |
Hiroball | 11:dc557e461dfd | 45 | wait(t_motor); |
Hiroball | 11:dc557e461dfd | 46 | } |
enricoan | 10:4f49e9859535 | 47 | } |
Hiroball | 11:dc557e461dfd | 48 | if (x_menos == 0){ |
Hiroball | 11:dc557e461dfd | 49 | for(int i = 0; i < 4; i++){ |
Hiroball | 11:dc557e461dfd | 50 | eixox = antih[i]; |
Hiroball | 11:dc557e461dfd | 51 | wait(t_motor); |
Hiroball | 11:dc557e461dfd | 52 | } |
enricoan | 10:4f49e9859535 | 53 | } |
Hiroball | 11:dc557e461dfd | 54 | if (y_mais == 0){ |
Hiroball | 11:dc557e461dfd | 55 | for(int i = 0; i < 4; i++){ |
Hiroball | 11:dc557e461dfd | 56 | eixoy = horario[i]; |
Hiroball | 11:dc557e461dfd | 57 | wait(t_motor); |
Hiroball | 11:dc557e461dfd | 58 | } |
enricoan | 10:4f49e9859535 | 59 | } |
Hiroball | 11:dc557e461dfd | 60 | if (y_menos == 0){ |
Hiroball | 11:dc557e461dfd | 61 | for(int i = 0; i < 4; i++){ |
Hiroball | 11:dc557e461dfd | 62 | eixox = antih[i]; |
Hiroball | 11:dc557e461dfd | 63 | wait(t_motor); |
Hiroball | 11:dc557e461dfd | 64 | } |
enricoan | 10:4f49e9859535 | 65 | } |
Hiroball | 11:dc557e461dfd | 66 | if (z_mais == 0){ |
Hiroball | 11:dc557e461dfd | 67 | for(int i = 0; i < 4; i++){ |
Hiroball | 11:dc557e461dfd | 68 | eixoz = horario[i]; |
Hiroball | 11:dc557e461dfd | 69 | wait(t_motor); |
Hiroball | 11:dc557e461dfd | 70 | } |
enricoan | 10:4f49e9859535 | 71 | } |
Hiroball | 11:dc557e461dfd | 72 | if (z_menos == 0){ |
Hiroball | 11:dc557e461dfd | 73 | for(int i = 0; i < 4; i++){ |
Hiroball | 11:dc557e461dfd | 74 | eixox = antih[i]; |
Hiroball | 11:dc557e461dfd | 75 | wait(t_motor); |
Hiroball | 11:dc557e461dfd | 76 | } |
enricoan | 10:4f49e9859535 | 77 | } |
Hiroball | 11:dc557e461dfd | 78 | } |
enricoan | 10:4f49e9859535 | 79 | } |