控制LED亮灭

点击查看代码
/******************************************************************************
* @file    main.c 
* @author  
* @version V1
* @date    
* @brief   Main program body
******************************************************************************/


#include "stm32f4xx.h"  //必须添加

//1.



//程序入口
int main()
{
	GPIO_InitTypeDef  GPIO_InitStructure;
	
	/* 2. GPIOF Peripheral clock enable */ 
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);
	
	/* 3. Configure PF9 in output pushpull mode */
	GPIO_InitStructure.GPIO_Pin 	= GPIO_Pin_9;
	GPIO_InitStructure.GPIO_Mode 	= GPIO_Mode_OUT;
	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
	GPIO_InitStructure.GPIO_PuPd 	= GPIO_PuPd_NOPULL;
	GPIO_Init(GPIOF, &GPIO_InitStructure);

  while(1)
	{
		/* Reset PF9 */
    GPIOF->BSRRH = GPIO_Pin_9 ;

	}
}


posted @ 2025-08-30 12:14  w1888  阅读(6)  评论(0)    收藏  举报