2023-01-11 10:52 PM
Hello,
I have configured my circuit to have a potentiometer and have set up an ADC with continuous conversion mode but I am unable to get a varied output. It just gets stuck on one value even thought I change the value of the potentiometer. Please help
I have attached my code below.
MX_ADC1_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
HAL_ADC_PollForConversion(&hadc1,1000);
readValue = HAL_ADC_GetValue(&hadc1);
/* USER CODE BEGIN 3 */
}
Thanks!
Solved! Go to Solution.
2023-01-12 12:45 AM
Hi @Killstreet30,
please double check that you configure your ADC properly, incl. proper channel/pin. Anyway, your code is probably missing
HAL_ADC_Start(&hadc1)
which means your ADC is not even enabled.
BR,
Jaroslav
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-01-12 12:45 AM
Hi @Killstreet30,
please double check that you configure your ADC properly, incl. proper channel/pin. Anyway, your code is probably missing
HAL_ADC_Start(&hadc1)
which means your ADC is not even enabled.
BR,
Jaroslav
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-01-12 01:45 AM
Thank you!