- #include "stm32f10x.h"
- #include "bsp_led.h"
- #include "bsp_key.h"
- void Delay(__IO uint32_t nCount);
- int main(void)
- {
- LED_GPIO_Config();
- Key_Config();
- while(1)
- {
- if(GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0) == KEY_ON)
- {
- LED1(ON);
- Delay(0x0FFFFF);
- LED1(OFF);
- LED2(ON);
- Delay(0x0FFFFF);
- LED2(OFF);
- LED3(ON);
- Delay(0x0FFFFF);
- LED3(OFF);
- LED4(ON);
- Delay(0x0FFFFF);
- LED4(OFF);
- LED5(ON);
- Delay(0x0FFFFF);
- LED5(OFF);
- LED6(ON);
- Delay(0x0FFFFF);
- LED6(OFF);
- LED7(ON);
- Delay(0x0FFFFF);
- LED7(OFF);
- LED8(ON);
- Delay(0x0FFFFF);
- LED8(OFF);
- }
- else
- {
- LED1(OFF);
- LED2(OFF);
- LED3(OFF);
- LED4(OFF);
- LED5(OFF);
- LED6(OFF);
- LED7(OFF);
- LED8(OFF);
- }
- }
- }
- void Delay(__IO uint32_t nCount)
- {
- for(; nCount !=0; nCount--);
- }
复制代码 全部资料51hei下载地址:
led.7z
(177.53 KB, 下载次数: 28)
|