新手入门
- 积分
- 7
- 金钱
- 7
- 注册时间
- 2025-1-5
- 在线时间
- 1 小时
|
楼主 |
发表于 2025-1-8 20:50:28
|
显示全部楼层
- while (1)
- {
- HAL_ADC_Start(&hadc1);
- if(HAL_ADC_PollForConversion(&hadc1, 100) == HAL_OK)
- {
- printf("the first successful!\n");
- adc_value1 = HAL_ADC_GetValue(&hadc1);
- printf("adc_value1 = %d\n", adc_value1);
-
- if(HAL_ADC_PollForConversion(&hadc1, 100) == HAL_OK)
- {
- printf("the second successful!\n");
- adc_value = HAL_ADC_GetValue(&hadc1);
- printf("adc_value = %d\n", adc_value);
- }
- else
- {
- printf("the second failed!\n");
- }
- }
- else
- {
- printf("the first failed!\n");
- }
-
-
- HAL_Delay(1000);
- /* USER CODE END WHILE */
- /* USER CODE BEGIN 3 */
- }
- /* USER CODE END 3 */
- }
复制代码 |
|