Go Down

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

ThierryD

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

the sketch is very easy :

#include<stdlib.h>
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.

Arctic_Eddie

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.

big_jose

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?

Thanks 

Arctic_Eddie

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.

big_jose

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

Thanks anyway

nestachan

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