2022-07-05 01:08 AM
i want to read out a single ADC (temperature sensor) via polling method and want to display the result on the Display. On the backside of the board are some standard arduino connectors, i used them to connect the temperature sensor (CN7 -> A0 -> PC0 ).
The problem is, that it is not working despite i used only standard code in the default task for reading it:
void StartDefaultTask(void *argument)
{
/* USER CODE BEGIN 5 */
uint16_t adcvalue;
/* Infinite loop */
for(;;)
{
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, 100);
adcvalue = HAL_ADC_GetValue(&hadc1);
HAL_ADC_Stop(&hadc1);
int resolution = 4096;
resistance1 = 10000*((adcvalue/(double)resolution)/(1-(adcvalue/(double)resolution)));
Temp1 = 1/((1/298.15)+((double)1/3435)*log((double)resistance1/10000));
Temp1 = Temp1 - 273.15;
osDelay(20);
}
/* USER CODE END 5 */
}
2022-07-06 11:35 PM
Hello, i don't want to read out the internal temperature Sensor. I want to read 3 external Sensors, but first i started with 1 sensor.