Hi:
I am using Attiny85 with SoftwareSerial, to send via bluetooth some information.
Everything works great, except when trying to send a float number.
Is there any way to solve this limitation?
Thanks in advance.
Hi:
I am using Attiny85 with SoftwareSerial, to send via bluetooth some information.
Everything works great, except when trying to send a float number.
Is there any way to solve this limitation?
Thanks in advance.
Everything works great, except when trying to send a float number.
How are you sending it?
for example
float voltios;
voltios = 2.34;
bluetooth.println(voltios);
if you change voltios to int... it works!
As you have discovered, println does not work with float. You would have to convert it to a string yourself and then send that.
Pete
As you have discovered, println does not work with float.
It most certainly does.
From SoftwareSerial.h:
class SoftwareSerial : public Stream
From Stream.h:
class Stream : public Print
From Print.h:
size_t print(double, int = 2);
Since floats and doubles are the same size on the Arduino, this is the method that gets called when SoftwareSerial::print() is called.
OP: We can't help you with snippets. Post ALL of your code.
Your problem may not be on the Arduino end.
Arghh. Wotinell was I thinking of? Oh yes. It's sprintf that doesn't do floats.
My bad.
Pete