Similar function in STM32 Cube as arduino serial.write and serial.print
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-11 5:57 AM - edited ‎2023-11-20 5:40 AM
Hi, i converting/translating an arduino code to STM32. Do someone know a similar function in STM32 Cube as arduino "serial.write" and "serial.print"?
I know that the function "HAL_UART_Transmit(&huart,Data, size, 100)" works simalarly as serial.write. Do someone know how to make your own "serial.print"? if Cube IDE has a similair function, it would be also good for me.
In the pictures you can find the explanation of arduino "serial.write" and "serial.print.
To retain about arduino serial.print is the following:
- Serial.print(78) gives "78"
- Serial.print(1.23456) gives "1.23"
- Serial.print('N') gives "N"
- Serial.print("Hello world.") gives "Hello world."
To retain about arduino serial.write is the following:
Serial.write(78); // send a byte with the value 78, so i think serial.write(78) gives "N" --> "N" is the ASCI character linked on decimal 78.
- Labels:
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-11 6:17 AM
Presumably you create a C++ class..
Alternatively you'd get the plumbing to the UART done, and then use puts(), putchar(), printf(), etc
Or write some subroutines, wrap the functionality, and do a search-n-replace to point to those instead
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-11 7:45 AM
Why did you start a new thread? See https://community.st.com/s/question/0D53W00002FqrNWSAZ/how-to-use-the-arduino-string-object-in-cube-ide
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-12 12:36 AM
I opened a new thread because the question was different.
