|
通過單片機(jī)控制跑馬燈的明亮
數(shù)碼管引腳圖.jpg (27.74 KB, 下載次數(shù): 54)
下載附件
2017-6-26 16:46 上傳
STM32源程序如下:
- //相關(guān)頭文件包含
- #include "delay.h"
- #include "sys.h"
- #include "led.h"
- #include "key.h"
- int main(void)
- {
- delay_init();
- LED_Init();
- Key_GPIO_Config();
- while(1)
- {
- if(Key_Scan(GPIOC,GPIO_Pin_0)==0)
- {
- GPIO_SetBits(GPIOC,GPIO_Pin_2);
- delay_ms (300);
- GPIO_ResetBits(GPIOC,GPIO_Pin_2);
- GPIO_SetBits(GPIOC,GPIO_Pin_3);
- delay_ms (300);
- GPIO_ResetBits(GPIOC,GPIO_Pin_3);
- GPIO_SetBits(GPIOC,GPIO_Pin_4);
- delay_ms (300);
- GPIO_ResetBits(GPIOC,GPIO_Pin_4);
- GPIO_SetBits(GPIOC,GPIO_Pin_5);
- delay_ms (300);
- GPIO_ResetBits(GPIOC,GPIO_Pin_5);
- GPIO_SetBits(GPIOC,GPIO_Pin_6);
- delay_ms (300);
- GPIO_ResetBits(GPIOC,GPIO_Pin_6);
- ……………………
- …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
獨(dú)立按鍵.zip
(344.15 KB, 下載次數(shù): 32)
2017-6-26 16:47 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
|