wrong voltage reading
Hi,
i'm trying to read voltage through voltage divider circuit, o/p voltage is 3.2, but i could read only around 2.7, can some help whats wrong with the code
note: R1=6.8K ohm and R2=12K ohm.
im attaching circuit and code.
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_SET);
// get ADC value
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);
raw=HAL_ADC_GetValue(&hadc1);
HAL_ADC_Stop(&hadc1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_RESET);
data= (3.3*raw/4095);
uint8_t length= sprintf(msg, "%.3lf\r\n\0", data);
HAL_UART_Transmit(&huart1, msg, length, 100);

