OLED 128x64 - Print a float

Grove is a modulated, ready-to-use tool set.
Much like Lego, it takes a building block approach to assembling electronics.

Moderators: lily.li, violet, jeremy882, crail.lyu969

Post Reply
burchd
Pre-kindergarten
Pre-kindergarten
Posts: 15
Joined: Tue Dec 27, 2011 10:27 am

OLED 128x64 - Print a float

Post by burchd » Tue Jan 22, 2013 12:13 pm

I have a DS18s20 temperature sensor which gives a 2 decimal place float as an output. Something like 21.95.

Can you give me a code example of how to print it to the screen? I keep getting a type conversion error

Invalid conversion from Char to unsigned char.

I am printing to the screen fine.

Also, can you give me an example of how to print a string variable.

This is fine...
unsigned char fill_string5a[]="00.00";

But if i do something like.
String stTemp = ltoa(temperature, buffer, 10);
sendStr(stTemp);

I get invalid conversion from string to unsigned char.

I am using Arduino 1.0.3

thanks in advance...
David...

User avatar
Jacket Chen
Staff
Staff
Posts: 659
Joined: Thu Jun 21, 2012 4:25 pm
Are you a staff member of seeedstudio?: yes
Which products/projects are your favorite?: Seeeduino Shields
Location: China

Re: OLED 128x64 - Print a float

Post by Jacket Chen » Wed Jan 23, 2013 9:20 am

burchd wrote:I have a DS18s20 temperature sensor which gives a 2 decimal place float as an output. Something like 21.95.
SeeedOled.putFloat(21.95);

burchd wrote:can you give me an example of how to print a string variable

float fill_string5a;
...
...
...
SeeedOled.putFloat(fill_string5a);
Love little, love long.

burchd
Pre-kindergarten
Pre-kindergarten
Posts: 15
Joined: Tue Dec 27, 2011 10:27 am

Re: OLED 128x64 - Print a float

Post by burchd » Thu Jan 24, 2013 11:31 am

Am i using the wrong library? Can i use the seeedoled one?

i only have

sendStr(fill_string6);
sendChar(fill_string6);

This was listed in the grove instructions.

User avatar
Jacket Chen
Staff
Staff
Posts: 659
Joined: Thu Jun 21, 2012 4:25 pm
Are you a staff member of seeedstudio?: yes
Which products/projects are your favorite?: Seeeduino Shields
Location: China

Re: OLED 128x64 - Print a float

Post by Jacket Chen » Mon Jan 28, 2013 2:44 pm

Yes , you could use SeeedOLED libraries.
Love little, love long.

burchd
Pre-kindergarten
Pre-kindergarten
Posts: 15
Joined: Tue Dec 27, 2011 10:27 am

Re: OLED 128x64 - Print a float

Post by burchd » Tue Jan 29, 2013 11:06 am

That works great! thankyou....

User avatar
Jacket Chen
Staff
Staff
Posts: 659
Joined: Thu Jun 21, 2012 4:25 pm
Are you a staff member of seeedstudio?: yes
Which products/projects are your favorite?: Seeeduino Shields
Location: China

Re: OLED 128x64 - Print a float

Post by Jacket Chen » Tue Jan 29, 2013 11:54 am

Enjou yourself.
Love little, love long.

Post Reply