Skip to main content
Associate II
September 19, 2024
Solved

Printing values

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?

This topic has been closed for replies.
Karl Yamashita
Karl YamashitaBest answer
Principal
September 20, 2024

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.

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source

5 replies

mƎALLEm
ST Technical Moderator
September 19, 2024

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 "Best answer" on the reply which solved your issue or answered your question.
slodhAuthor
Associate II
September 20, 2024

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?

Karl Yamashita
Karl YamashitaBest answer
Principal
September 20, 2024

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.

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source