一、配置
二、代码
/* USER CODE BEGIN WHILE */while (1){/** 引脚默认上拉 高电平 按键按下 读取到低电平* */if(HAL_GPIO_ReadPin(GPIOB,KEY_Pin) == GPIO_PIN_RESET ){HAL_Delay(20);if(HAL_GPIO_ReadPin(GPIOB,KEY_Pin) == GPIO_PIN_RESET ){HAL_GPIO_TogglePin(GPIOC,LED_Pin);while(HAL_GPIO_ReadPin(GPIOB,KEY_Pin) == GPIO_PIN_RESET);}}/* USER CODE END WHILE */