int main(void){ /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */}...../* USER CODE BEGIN 4 */void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){ unsigned i; i=5000; while(i--); //HAL_Delay(20);//延时函数消抖,防止误触发 if(HAL_GPIO_ReadPin(KEY_GPIO_Port,KEY_Pin)==0) { HAL_GPIO_TogglePin(LED_GPIO_Port,LED_Pin);//翻转LED电平 }}/* USER CODE END 4 */ 结语本文大部分内容都属于原创,如需转载,请附上本文网站,
如果需要相关的仿真图、程序代码等资料可以直接私信我,我会及时回复。