一、配置
二、代码
/* USER CODE BEGIN 2 */
OLED_Init();
OLED_Clear();
OLED_ShowString(0,0,"Hello adc",12,0);
uint16_t adc_number= 0;
/* USER CODE END 2 */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1,HAL_MAX_DELAY);
adc_number = (uint16_t)HAL_ADC_GetValue(&hadc1);
// OLED_Clear();
OLED_ShowNum(0,0,adc_number,6,12,0);
HAL_Delay(10);
/* USER CODE END WHILE */