cancel
Showing results for 
Search instead for 
Did you mean: 

Doubt regarding potentiometer ADC Values on STM32 NUCLEO - L476RG.

Killstreet30
Associate III

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Jaroslav JANOS
ST Employee

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.

View solution in original post

2 REPLIES 2
Jaroslav JANOS
ST Employee

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.

Killstreet30
Associate III

Thank you!