Question
I have an L475 Discovery IoT node, I want to collect sensor data from the board and save it in a text file in my laptop which is USB connected to the board. I have tried Fprint and fwrite but it doesn't seem to work.
fp=fopen("Issamos.csv","w+");
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
temp_value = BSP_TSENSOR_ReadTemp();
int tmpInt1 = temp_value;
float tmpFrac = temp_value - tmpInt1;
int tmpInt2 = trunc(tmpFrac * 100000);
snprintf(str_tmp,100," TEMPERATURE = %d.%02d\n\r", tmpInt1, tmpInt2);
HAL_UART_Transmit(&huart1,( uint8_t * )str_tmp,sizeof(str_tmp),1000);
fwrite(str_tmp, 100, 1,fp);
fclose(fp);
as you see I am collecting the data and using snprintf to display it in true studio, but writing it to a file doesn't work
