Convert from char to float format

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

Post Reply
Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Convert from char to float format

Post by Monie Jacobsen »

HI everbody
Want to convert char theDate [8]; to float format.
And float = day to show when printing to display eksemple: 23

Has attached Ardino file: MiacCloack.ino
MiacClock.zip
(911 Bytes) Downloaded 337 times
Info: MIAC (Arduino) type MI5466
Best Regard
Monie

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Convert from char to float format

Post by LeighM »

You would need to separate out the day from the date string, using strncpy() then toFloat()
Or toInt() not sure why you need float.
Search these functions in web Arduino reference.

That MIAC example shows how to print the day value one character at a time.

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: Convert from char to float format

Post by Monie Jacobsen »

Hi LeighM
Thanks for the answer.
Trying to search the Arduino again on solution;-)
Best Regard
Monie

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Convert from char to float format

Post by LeighM »

OK, hope it helps.
Otherwise i could possibly add some functions to the MIAC library to return clock parameters as integers - next week.

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: Convert from char to float format

Post by Monie Jacobsen »

Hi LeighM
Do you help with add some functions til MIAC library to return clock parameters as integers?
Best Regard
Monie

Post Reply