Código para o menu no LCD
Dependencies: mbed SDFileSystemSD TextLCD
Fork of TextLCD_HelloWorld2 by
Diff: classes.h
- Revision:
- 21:7603fe283ba4
- Parent:
- 20:ccbd80b668ce
- Child:
- 22:22ddb0b21d48
--- a/classes.h Tue May 15 14:35:25 2018 +0000 +++ b/classes.h Tue May 15 16:20:06 2018 +0000 @@ -113,6 +113,11 @@ public: int linha; int func; + int points; + int pointx; + int pointy; + int pointz; + void movercursor(int min, int max, int col){ //função para mover cursor de seleção linha = min; @@ -161,6 +166,9 @@ lcd.locate(2,3); lcd.printf("%.3f", cz); } + if Mach.readable(){ + readSerial(); + } } } @@ -375,6 +383,8 @@ movercursor(2,3,13); if (bot_enter!=penter) { if (linha==2){ + machine.kill_jog(); + wait(0.1); machine.start_program(); exec = 1; func = 9; @@ -494,7 +504,35 @@ lcd.printf("Conclua seu programa"); wait(1); func = 2; - } + } + + + private: + void readSerial(){ + char recv; + + while(1){ + recv = Mach.getc(); + printf("%c\n\r", recv); + if (recv=='p'){ + points = 1; + if (recv=='X'){ + pointx = 1; + cx = + } + else if (recv=='Y'){ + pointy = 1; + cy = + } + else if (recv=='Z'){ + pointz = 1; + cz = + else if (recv=='x'){ + break; + } + } + } + } + Menu(); //não apagar - Menu(); //não apagar }; \ No newline at end of file