system
1
Hy
I think someone has already asked this but I couldn't find the post..
So I got a sketch running in wich I have to print a Float value over the Serial port.
for example
float test = 231,02312
Serial.print((long)((float)test ));
I do get 231 that's good but how do I get the rest? The '0' is my problem it won't store in an Int value of course. so how can I print it?
thx
Andy
system
2
As of 0018:
Serial.print(test, nDP);
will give "nDP" places of decimals.
system
3
hmm thx but it doens't relay work...
I tested it with:
for (int i=1;i<9;i++){
Serial.println(lat, i);
}
Result:
231.0
231.02
231.023
231.0231
231.02311
231.023117
231.0231170
231.02311706
Not one of this is the right one...
system
4
Not one of this is the right one
It's a float - what sort of accuracy do you expect?
system
5
the value has always 5 places of decimals it won't change.
so there is no way?
system
6
You could try fixed-point instead, it depends on what sort of dynamic range you've got.