String to Float problems.
in
Programming Questions
•
2 years ago
I've been trying to do this for hours now and got no useful result as yet.
I'm receiving data from an arduino, and using the line feed, carraige return and space characters to seperate the data into strings.
I am then using trim(string) on each one to eliminate those characters.
An example string is "-0.63" or "0.14" but anything put in returns "0.0"
and I have used so far the following methods to try and convert the string,
I'm receiving data from an arduino, and using the line feed, carraige return and space characters to seperate the data into strings.
I am then using trim(string) on each one to eliminate those characters.
An example string is "-0.63" or "0.14" but anything put in returns "0.0"
and I have used so far the following methods to try and convert the string,
float f = Float.valueOf(str).floatValue();
float f = Float.parseFloat(str);
float f = new Float(str);
and I've tried float(str); that didn't work either. Also tried
strtof but that doesn't seem to exist in processing.
No idea whats going on here. I can't post the full code as it is on
another computer with no internet.
Thanks in advance for any help, As I'm at a loss here for what to do now.
1