/* USER CODE BEGIN PV */
uint32_t ADC_Value, Flame_Percentage;
/* USER CODE END PV */
/* USER CODE BEGIN PFP */
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
ADC_Value = HAL_ADC_GetValue(&hadc1); /* Get ADC Value */
Flame_Percentage = 100 - (ADC_Value * 100.0/4095); /* Map ADV value from 0 to 100 */
}
/* USER CODE END PFP */
HAL_ADC_Start_IT(&hadc1); /* Enables the interrupt and Starts ADC conversion */
HAL_Delay(1000);
For questions or business inquiries, contact me:
📱 WhatsApp: https://wa.me/+201006085975
💼 LinkedIn: / ehabmagdyy
🌐 Facebook: / ehab.magdy.04
#stm32 #adc #embeddedsystems #embeddedsoftware