How do I print floats, fixed point numbers, integers, arrays full of some data type, etc. to a serial monitor?
Hi, I would like to print floating point, fixed point values, integers, arrays of values, etc. to a serial monitor of some kind for debugging purposes. I want to be able to see exactly what my code is doing (I know floats are HUGE in embedded code so I really won't use them, but the principle is what counts). It seems that using CDC_Transmit_FS(&buff, sizeof(buff)) from the USB VCOM class doesn't work. I've even tried to connect my stm32 to an arduino via uart to maybe send the data to the arduino and have the arduino print to the serial monitor (yeah, I know that's a really dumb way to do it), but that hasn't worked out so far. I've researched a lot to try and figure out how to do this. All I can seem to find has me make a uint8_t variable[] = "Text\r\n" (not sure why the empty square brackets are used), and I can't figure out how this might or might not apply to those fixed point, integer, and array, etc. data types.
I also wonder what the maximum fixed point or integer integer value, or array size, etc. that I can print. I'm not sure what I need to understand in order to know the answer to that question though.
I can get this to work and that's about it:
uint8_t buffer[] = "Hello, World!\r\n";
CDC_Transmit_FS(buffer, sizeof(buffer));
I don't want to only print strings, however, but that's all I can do at the moment.
I'm also pretty new to stm32.
Thank you in advance for taking the time to read and respond :smiling_face_with_smiling_eyes:
