新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > STM32F1003BR基于3.5固件庫的LED燈

STM32F1003BR基于3.5固件庫的LED燈

作者: 時間:2016-12-01 來源:網(wǎng)絡 收藏
#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);

本文引用地址:http://2s4d.com/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燈,循環(huán)亮滅*********************************************
************************************************************************/



評論


技術專區(qū)

關閉