新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > STM32F1003BR基于3.5固件库的LED灯

STM32F1003BR基于3.5固件库的LED灯

作者: 时间:2016-12-01 来源:网络 收藏
#include "stm32f10x.h"

/***********************************************************************
************************************************************************/
GPIO_InitTypeDef GPIO_InitStructure;
/***********************************************************************
************************************************************************/
void delay(vu32 nCount)
{
for(; nCount != 0; nCount--);
}
/***********************************************************************
************************************************************************/
main()
{
/* GPIOD Periph clock enable */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);

/* Configure PD0 and PD2 in output pushpull mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOD, &GPIO_InitStructure);

本文引用地址:https://www.eepw.com.cn/article/201612/324394.htm

while(1)
{
GPIO_ResetBits(GPIOD,GPIO_Pin_2);
delay(5000000);
GPIO_SetBits(GPIOD,GPIO_Pin_2);
delay(5000000);
}
}

/*PD.2端口接LED灯,循环亮灭*********************************************
************************************************************************/



评论


技术专区

关闭
站长统计
×

TI直播中...
汽车电气化背景下的TI音频解决方案和技术线上研讨会直播中,早鸟报名礼、myTI 专属礼、活动参与礼等着您(已经报名用户可以凭报名邮箱直接登录),速入>>