GPIO配置:  void MX_GPIO_Init(void) {   GPIO_InitTypeDef GPIO_InitStruct = {0};   /* GPIO Ports Clock Enable */   __HAL_RCC_GPIOA_CLK_ENABLE();   __HAL_RCC_GPIOB_CLK_ENABLE();   /*Configure GPIO pin : PB0 */   GPIO_InitStruct.Pin = GPIO_PIN_0;   GPIO_InitStruct.Mode = GPIO_MODE_INPUT;   GPIO_InitStruct.Pull = GPIO_NOPULL;   HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);    HAL_GPIO_WritePin(GPIOB,GPIO_PIN_0,GPIO_PIN_RESET); }  
主函数while循环:   while (1)   {                  PB0 = HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_0);                 printf("PB0 = %d\r\n",PB0);                 HAL_Delay(100);   } 
 
  
 
 
 |