2024-09-18 08:44 PM - last edited on 2024-09-20 07:56 AM by SofLit
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?
2024-09-19 12:51 AM
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.
2024-09-19 08:01 PM - last edited on 2024-09-20 07:57 AM by SofLit
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?
2024-09-20 12:57 AM
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.
2024-09-20 07:56 AM
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.
2024-09-20 08:13 AM
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.