int main(void)
{
MX_GPIO_Init();
MX_USART1_UART_Init();
MX_ADC1_Init();
printf("this is adc\n");
while (1)
{
HAL_ADC_Start(&hadc1);
while((hadc1.Instance->DR)==RESET);
temp=HAL_ADC_GetValue(&hadc1);
printf("light adc=%d\n",temp);
while((hadc1.Instance->DR)==RESET);
ht adc2=%d\n",temp);
HAL_Delay(1000);
}
}
|