cancel
Showing results for 
Search instead for 
Did you mean: 

Printing values

slodh
Associate II

I am using 16 sensors for my project and I need to print the sensor number and the corresponding signal strength for a ML model, but I am missing a lot of values. Is there an efficient way to do this?

5 REPLIES 5
SofLit
ST Employee

Hello @slodh and welcome to the community.

You need to provide more than that as information to let community memebers to help you efficiently.

Please refer to our recommendations on how to post a thread.

Thank you for your understanding.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I am using stmcube 32 Ide to code and VS code to get the output. I want to print the values of my 16 sensors and its corresponding data such as signal strength , distance on Y axis and distance on x axis

for (int i = 0; i < TOF_NUM; i++)

{

Serial.print("SN%i",i); // Sensor number from si array

Serial.print("|");

Serial.print("%f",sensorSignal[i]); // Signal strength with 2 decimal places

Serial.print("|");

Serial.print("%f",distI[i]); // Distance with 2 decimal places

Serial.print("\n");

}

Serial.print("DX:%.2f",minDistX); // Distance with 2 decimal places

Serial.print("\n--");

This is the code that I am using. But when I print the values I get a lot of missing values which might be because my loop time is very small (9 - 11 ms , but this it the ideal loop time for my project and I don't want to change it). I want to print the values in a proper format and without any missing values to export the values to an excel file which I can then use for my machine learning model. Could you please provide me a solution where I can print the values in the proper format with no missing values?

Serial.Print looks to be Arduino code so you should be asking in Arduino forum.

 

Anyways, test return value when you print to see if the amount of bytes have been sent correctly. Then continue with the next print.

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

Hello,

Looks like the code is for Arduino IDE not for STM32CubeIDE. You need to ask them on their forum here.

Otherwise, to use ST tools: STM32CubeMx and CubeIDE and to print messages on terminal over UART using STLink Virtual Comport (VCP) please refer to this article.

Hope it helps.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Perhaps more efficient ways of getting the data off-board, and not human printable ASCII spread over multiple lines? Send less stuff, send it in native forms.

The bandwidth of the communications channel is going to constrain how quickly this can be done. This stuff doesn't run infinitely fast, nor teleport the data.

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