456
int main(void) { HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_USART1_UART_Init(); delay_us_dwt_init(); // Initialize the DWT for delays uartx_write_text(&huart1, "Initialization complete\r\n"); while (1) { float temperature = DS18b20_temp(); // Get temperature char buffer[50]; sprintf(buffer, "Temperature = %.2f°C\r\n", temperature); uartx_write_text(&huart1, buffer); // Send temperature over UART HAL_Delay(800); // Wait before next read HAL_GPIO_TogglePin(led_GPIO_Port, led_Pin); // Toggle LED } }