costy35
September 18, 2018, 12:22pm
1
I thing that my problem is already resolved in forum ... by i search and not find anything .Perhaps exist somewhere... ut where?
So ... I have
String b="";
while(f.available()) {
b +=f.read();
}
f.close();
So read file into b string
file contain gcode same :
G01 X100.123 Y200.345\nG01 X234.100 Y432.654\n .... ecc
So with indexOf i can find index of first X but i dont know how read integer value
int x= b.indexOf('X');
int y=b[x].toInt();
give me a error:
'b.String::operator[](((unsigned int)x))', which is of non-class type 'char'
y will need be 100.123
Any help or topic?
Regards!
system
September 18, 2018, 12:44pm
2
So read file into b string
That is NOT what that code does. There is a HUGE difference between a string (that you should be using) and a String (that you should avoid like the plague).
b[ x ] IS a char. You can't convert a char to an int.
Look up the substring() method.
costy35
September 18, 2018, 2:39pm
3
I see now and i thing that i need a string ... not a integer...
Because i try to finished a wifi gcodesender...
I create a html page that transform a jpg image to gcode
over wifi send gcode file to SPIFFS esp8285 that is connected to cnc
With esp8255 transfer file to a variable string , and after ...
send line by line to gcode interpreter .
When read a line ,send this line to gcode interpreter routine , but in same time
send to client a response 100 continue with a svg file with line segments...
in this mode i can see "live" where cnc cutting position.
For this substring routine is ok for me ... i study that!
Thanks!