Código para o menu no LCD
Dependencies: mbed SDFileSystemSD TextLCD
Fork of TextLCD_HelloWorld2 by
Diff: classes.h
- Revision:
- 24:46c3be0e8273
- Parent:
- 23:19c67758032d
- Child:
- 25:af1f99666ca9
--- a/classes.h Tue May 15 17:58:04 2018 +0000 +++ b/classes.h Tue May 15 18:04:02 2018 +0000 @@ -502,31 +502,37 @@ void readSerial(){ char recv; - int points; - int pointx; - int pointy; - int pointz; - string coordx; - string coordy; - string coordz; + int points = 0; + int pointx = 0; + int pointy = 0; + int pointz = 0; + string coordx = ""; + string coordy = ""; + string coordz = ""; while(1){ recv = Mach.getc(); //printf("%c\n\r", recv); - if (recv=='p'){ + if (recv == 'p'){ points = 1; } if (points){ - if (recv=='X'){ + if (recv == 'X'){ pointx = 1; + pointy = 0; + pointz = 0; } - else if (recv=='Y'){ + else if (recv == 'Y'){ pointy = 1; + pointx = 0; + pointz = 0; } - else if (recv=='Z'){ + else if (recv == 'Z'){ pointz = 1; + pointx = 0; + pointy = 0; } - else if (recv=='x'){ + else if (recv == 'x'){ cx = atof(coordx.c_str()); cy = atof(coordy.c_str()); cz = atof(coordz.c_str()); @@ -535,17 +541,17 @@ } } if (pointx){ - if (recv!='X' || !pointy || !pointz){ + if (recv!='X'){ coordx.push_back(recv); } } if (pointy){ - if (recv!='Y' || !pointx || !pointz){ + if (recv!='Y'){ coordy.push_back(recv); } } if (pointz){ - if (recv!='Z' || !pointy || !pointx){ + if (recv!='Z'){ coordz.push_back(recv); } }