GroveStreams
joseph private msg quote post Address this user
HI Mike ,
I trying using Arduino Temp by Arduino DUE board , but i have error message for :

Arduino: 1.6.7 (Windows 7), Board: "Arduino Due (Programming Port)"

Arduino-LM35-GS_Platform-2:207: error: 'dtostrf' was not declared in this scope

dtostrf(degreesC, 12, 3, tempC); //Convert float to string
exit status 1
'dtostrf' was not declared in this scope

Please help me solve problem.

Best Regards
Post 1 IP   flag post
MThomas private msg quote post Address this user
Your compiler doesn't know what dtostrf is. You need to include the library that has that method defined in it. Try including <avr/dtostrf.h>

#include < avr/dtostrf.h >


dtostrf is not part of the supported Arduino API. It is offered by avr-libc, but not libc on other architectures.
Post 2 IP   flag post
joseph private msg quote post Address this user
Hi ,

I see you addressed by AVR and i asked you for Arduino DUE by ARM .
So, i tried by your code and problem exist.
Pls update.
Post 3 IP   flag post
MThomas private msg quote post Address this user
You are trying to use dtostrf, which is an AVR library function. It doesn't exist in ARM's standard library. This is why your code doesn't work. You need to either find a different way to convert your float to a string or you need to add the code for dtostrf.

Try using sprintf, it will copy your float value into your string.

sprintf(tempC, "%4.3f", degreesC)


or maybe try String::toFloat()

Here's the link if you want to add dtistrf yourself: link
Post 4 IP   flag post
3028 4 4
Log in or sign up to compose a reply.