Docs

Micro-controllers, wireless transmission and database

Head

Potentiometer ADC with Nucleo F446RE using STM32CubeIDE

Prerequisites

This project assumes you have already installed STM32CubeIDE. You need to have previously done a basic blink sketch with Nucleo STM32F446RE using STM32CubeIDE. I have made a complete video from installing STM32CubeIDE to LED blink program. You can watch it by clicking this link. https://www.youtube.com/watch?v=oAwZ0cjlmN8

Wiring Diagram

Diagram

Image

STM32CubeIDE Settings

ADC1 - IN0 (tick)

Parameter Settings --> ADC Settings --> Continuous Conversion Mode (Enabled)

Additional code on top of STM32CubeIDE generated code

/* USER CODE BEGIN PV */
uint16_t readValue;
/* USER CODE END PV */

  /* USER CODE BEGIN WHILE */
  while (1)
  {
    HAL_ADC_Start(&hadc1);
    HAL_ADC_PollForConversion(&hadc1,1000);
    readValue = HAL_ADC_GetValue(&hadc1);
    HAL_ADC_Stop(&hadc1);
    HAL_Delay(1000);
    /* USER CODE END WHILE */