#include <stm32f10x.h>
#include <delay.h>
int main()
{
GPIO_InitTypeDef GPIO_Initstruct;//定义GPIO结构体
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);//开启GPIOC时钟
GPIO_Initstruct.GPIO_Mode = GPIO_Mode_Out_PP;//设置为推挽输出
GPIO_Initstruct.GPIO_Pin = GPIO_Pin_13;//LED灯引脚为PC13
GPIO_Initstruct.GPIO_Speed = GPIO_Speed_50MHz;//设置速度为50MHz
GPIO_Init(GPIOC,&GPIO_Initstruct);//初始化GPIOC
while(1)
{
GPIO_SetBits(GPIOC,GPIO_Pin_13);//通过设置PC13引脚为低电平点亮LED
Delay_ms(200);//延时200ms
GPIO_ResetBits(GPIOC,GPIO_Pin_13);//通过设置PC13引脚为高电平熄灭LED
Delay_ms(200);
}
}
使用stm32f103C8T6实现流水灯
最新推荐文章于 2024-09-16 21:22:27 发布