(3)在main.c中添加调用和打印语句。
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_Delay(500);
HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_0); //设置LED1反转
adc_vol=z_ADC_sample(); //获取ADC的vol倿
sprintf((char*)str_adc_vol,"hello world,this is adc test,adc==%.2f\r\n",adc_vol);
HAL_UART_Transmit(&huart1, (uint8_t*)str_adc_vol,100,5);
}
/* USER CODE END 3 */
|