Go Down

Topic: Arduino due and dtostrf function problem (Read 4024 times) previous topic - next topic


Hi all,
I have a problem with the function 'dtostrf'

the sketch is very easy :

void setup()
  char temp[8];
  dtostrf(0.012, 8 ,2 ,temp);

the arduino IDE is the 1.5.1r2 and I use an Arduino due.
With older IDE version and other Arduino (nano, Uno), I use this function with no problem.

The error message in the IDE is : error: 'dtostrf' was not declared in this scope
but I have include stdlib.h

Where is the problem ?
Have you another way to convert a float to string with a specific digit (not for serial.print) ?

thanks in advance for your answer.


I had a similar problem with itoa() not being found. The sprintf() function worked better for my application.

There is a library search and path problem when compiling for the Due.


I have the same problem too. The arduino IDE is the 1.5.1r2 with the Arduino due doesn't recognize the 'dtostrf' function .
Is there any solution for this?



You might try to find the library containing the function and put it in the #include section. I've tried it with other functions using the complete path and it still doesn't see it. Even the math.h file is not found. There appears to be a serious path problem with this version of the IDE. Not sure what your function does but sprintf() may work in it's place. It worked nicely for my application.


The sprintf() function doesn´t work for my application. I will try to find the library and put it on the IDE.

Thanks anyway


I added #include <dtostrf.h> to my code for Arduino DUE but no work. Then I search a solution from C/C++ text book that is about write your function and including.I was found the core folder and seem missing dtostrf.h. So i trial re-add the file and compiled...........OK  :P.

That have been solved by adding header file   [font=Verdana]#include <avr/dtostrf.h>[/font] to WString.h file.
Path: \\arduino-1.5.6-r2\hardware\arduino\sam\cores\arduino

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131