Conversion from String.(substring) to float

Dear Arduino programmers,

Although the float() conversion claims that it can convert any type to float, it won't except Srting object.
Ok I can understand that, so I converted the String to a char[] type. But the float conversion still doesn't work.
(I tried *char instead of char after i got an error message telling me there is a cast incompatibility)
Bij pointing at the char I only get the firts character (5 while i should get 52 )
Can somebody help me with converting String objects into floats ?

Best regards Rob

You can use float atof(char *) from stdlib.h

#include <stdlib.h>

void setup()
{
  Serial.begin(115200);
  Serial.println(atof("123.456"),1);
}

void loop()
{}

More libs see - http://www.nongnu.org/avr-libc/user-manual/modules.html -

I tried *char instead of char after i got an error message telling me there is a cast incompatibility

In what code? If you have a code problem, doesn't it seem reasonable that you should post the code?

Bij pointing at the char I only get the firts character (5 while i should get 52 )

Once more, without typos, please.

I just answered this elsewhere, with code you could use:

Hope it helps.