久久ER99热精品一区二区-久久精品99国产精品日本-久久精品免费一区二区三区-久久综合九色综合欧美狠狠

新聞中心

EEPW首頁 > 嵌入式系統 > 設計應用 > STM32基于3.5庫的LED燈2

STM32基于3.5庫的LED燈2

作者: 時間:2016-12-01 來源:網絡 收藏
3.5的庫在這里:http://www.51hei.com/mcu/2765.html

#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 PD.2 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://cqxgywz.com/article/201612/324406.htm


RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

/* Configure PA.8 in output pushpull mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);


while(1)
{
GPIO_ResetBits(GPIOD,GPIO_Pin_2); //設置所選定的端口的一個或多個所選定的位為低
GPIO_WriteBit(GPIOA,GPIO_Pin_8,Bit_SET); //置位或清除所選定的特定位
delay(5000000);
GPIO_SetBits(GPIOD,GPIO_Pin_2); //設置所選定的端口的一個或多個所選定的位為高
GPIO_WriteBit(GPIOA,GPIO_Pin_8,Bit_RESET); //置位或清除所選定的特定位
delay(5000000);
}
}

/*PD.2和PA.8端口接LED燈,循環亮滅*********************************************
*****************************************************************************/



關鍵詞: STM3235庫LED

評論


技術專區

關閉