cancel
Showing results for 
Search instead for 
Did you mean: 

Similar function in STM32 Cube as arduino serial.write and serial.print

FLuba.1
Associate III

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.


_legacyfs_online_stmicro_images_0693W00000bjsKmQAI.png
_legacyfs_online_stmicro_images_0693W00000bjsLBQAY.png
_legacyfs_online_stmicro_images_0693W00000bjsLGQAY.png 

3 REPLIES 3

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

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

I opened a new thread because the question was different.