Solved
Read adc value from potentiometer
Posted on May 02, 2017 at 12:07
Hi
I am trying to read an adc value from a potentiometer with the following code:
uint32_t readADCServo()
{ uint32_t adcValue, adcValueDegrees; HAL_ADC_Start(&hadc1); if (HAL_ADC_PollForConversion(&hadc1, 1)!=HAL_OK) { } while ((HAL_ADC_GetState(&hadc1) & HAL_ADC_STATE_REG_EOC ) == HAL_ADC_STATE_REG_EOC) { adcValue = HAL_ADC_GetValue(&hadc1); } HAL_Delay(1); adcValueDegrees = (adcValue * 180 / 4095) -90; return adcValueDegrees; }The only value i get in adcValue is
536872088. No matter the position of the potentiometer.
Does anyone have a soluton for my problem?
#read-adc-potentiometer #adc