uint32_t ADC_Value[2];//ADC采集存储 uint8_t i; float ad1,ad2;存储转化为电压的变量
for(i=0;i<2;i++) { HAL_ADC_Start(&hadc1); HAL_ADC_PollForConversion(&hadc1,0xffff); ADC_Value[i]=HAL_ADC_GetValue(&hadc1); } HAL_ADC_Stop(&hadc1); ad1 = (float)(ADC_Value[0]&0xFFF)*3.3/4096; ad2 = (float)(ADC_Value[1]&0xFFF)*3.3/4096;
转化后的AD电压值可用串口或者显示屏查看。
原文:https://www.cnblogs.com/lailai-laird/p/12768130.html