標(biāo)題:
基于stm32f103的跑馬燈源代碼
[打印本頁]
作者:
pshh0420
時間:
2018-4-12 20:47
標(biāo)題:
基于stm32f103的跑馬燈源代碼
開發(fā)板是stm32f103
代碼不是原創(chuàng),純分享
大家一起學(xué)習(xí)
單片機(jī)源程序如下:
#include "led.h"
#include "delay.h"
#include "sys.h"
int main(void)
{
delay_init(); //延時函數(shù)初始化
LED_Init(); //初始化與LED連接的硬件接口
while(1)
{
GPIO_ResetBits(GPIOA,GPIO_Pin_8); //LED0輸出低
GPIO_SetBits(GPIOD,GPIO_Pin_2);//LED1輸出高
delay_ms(300);
GPIO_SetBits(GPIOA,GPIO_Pin_8); //LED0輸出低
GPIO_SetBits(GPIOD,GPIO_Pin_2);//LED1輸出高
delay_ms(300);
GPIO_ResetBits(GPIOA,GPIO_Pin_8); //LED0輸出低
GPIO_SetBits(GPIOD,GPIO_Pin_2);//LED1輸出高
delay_ms(300);
GPIO_SetBits(GPIOA,GPIO_Pin_8); //LED0輸出低
GPIO_SetBits(GPIOD,GPIO_Pin_2);//LED1輸出高
delay_ms(300);
GPIO_SetBits(GPIOA,GPIO_Pin_8);//LED0輸出高
GPIO_ResetBits(GPIOD,GPIO_Pin_2);//LED1輸出低
delay_ms(300);
GPIO_SetBits(GPIOA,GPIO_Pin_8); //LED0輸出低
GPIO_SetBits(GPIOD,GPIO_Pin_2);//LED1輸出高
delay_ms(300);
GPIO_SetBits(GPIOA,GPIO_Pin_8);//LED0輸出高
GPIO_ResetBits(GPIOD,GPIO_Pin_2);//LED1輸出低
delay_ms(300);
GPIO_SetBits(GPIOA,GPIO_Pin_8); //LED0輸出低
GPIO_SetBits(GPIOD,GPIO_Pin_2);//LED1輸出高
delay_ms(300);
}
}
復(fù)制代碼
所有資料51hei提供下載:
跑馬燈.rar
(273.12 KB, 下載次數(shù): 22)
2018-4-13 01:29 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1