Código para o menu no LCD
Dependencies: mbed SDFileSystemSD TextLCD
Fork of TextLCD_HelloWorld2 by
Diff: classes.h
- Revision:
- 23:19c67758032d
- Parent:
- 22:22ddb0b21d48
- Child:
- 24:46c3be0e8273
--- a/classes.h Tue May 15 16:42:54 2018 +0000 +++ b/classes.h Tue May 15 17:58:04 2018 +0000 @@ -113,11 +113,7 @@ 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; @@ -215,7 +211,6 @@ //func 2 void jog(){ //função tela jog bot_enter = 0; - coords = 0; machine.kill_jog(); wait(0.1); machine.jog(); @@ -236,7 +231,6 @@ lcd.printf("Cancelar"); movercursor(1,3,10); if (bot_enter!=penter){ - //coords = 1; if (linha==1){ if (pontos>0){ pontos--; @@ -508,30 +502,57 @@ void readSerial(){ char recv; + int points; + int pointx; + int pointy; + int pointz; + string coordx; + string coordy; + string coordz; while(1){ recv = Mach.getc(); - printf("%c\n\r", recv);/* + //printf("%c\n\r", recv); if (recv=='p'){ points = 1; + } + if (points){ if (recv=='X'){ pointx = 1; - cx = } else if (recv=='Y'){ pointy = 1; - cy = } else if (recv=='Z'){ pointz = 1; - cz = + } else if (recv=='x'){ + cx = atof(coordx.c_str()); + cy = atof(coordy.c_str()); + cz = atof(coordz.c_str()); + printf("%s,%s,%s\n\r", coordx, coordy, coordz); break; } - } - }*/ + } + if (pointx){ + if (recv!='X' || !pointy || !pointz){ + coordx.push_back(recv); + } + } + if (pointy){ + if (recv!='Y' || !pointx || !pointz){ + coordy.push_back(recv); + } + } + if (pointz){ + if (recv!='Z' || !pointy || !pointx){ + coordz.push_back(recv); + } + } + + } } - } + Menu(); //não apagar }; \ No newline at end of file