convert float to string not working

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi there,

   

I try to use 

   

sprintf (My_String, "%f ;", longitudeDegrees);
UART_PutString(My_String);

   

but this doesn't work.

   

sprintf (My_String, "%d ;", counter);

   

UART_PutString(My_String);

   

but this one is working. i think there a problem with convert from flaot to string. I am using PSoC Creator 3.3, ARM GCC 4.9-2015-q1-update, and PSoC 5 LP.

   

Could you help me with this problem? Thanks

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Hi Peter!

   

Set "Heap Size" to 0x0200 (in cydwr view, system tab)

   

Set "Use newlib-nano float formatting" to true (in Project->Build Settings -> Linker)

   

This should work Creator 3.3

   

 

   

Happy coding

   

Bob

View solution in original post

3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Hi Peter!

   

Set "Heap Size" to 0x0200 (in cydwr view, system tab)

   

Set "Use newlib-nano float formatting" to true (in Project->Build Settings -> Linker)

   

This should work Creator 3.3

   

 

   

Happy coding

   

Bob

Anonymous
Not applicable

That's working Bob. thanks so much

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You're always welcome, Peter!

   

 

   

Bob

0 Likes