cancel
Showing results for 
Search instead for 
Did you mean: 

Newline not working in string

VEnes.1
Associate

I use stm32cubeIDE

my code:

sprintf( mesaj, "xaccl = %3.3f /n ", xaccl );
HAL_UART_Transmit( &huart6, mesaj, sizeof(mesaj), HAL_MAX_DELAY );

how I can fix /n terminal problem?

thanks for answers

0693W00000QNYriQAH.bmp

This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3

Use the proper escape character, ie \n

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Might also point out that sprintf returns the length of the generated string, and sizeof() isn't suitable for strings.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Bob S
Principal

And use snprintf() instead of sprintf(). Friends don't let friends use sprintf().