拓冰建站拓冰建站
首页 / 资讯中心 / 正文

day3 跑马灯

#include stm32f10x.h // Device header #include Delay.h int main(void){ //外设时钟控制函数 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE); GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Mode GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Pin GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8; GPIO_InitStructure.GPIO_Speed GPIO_Speed_50MHz; GPIO_Init(GPIOA,GPIO_InitStructure); while(1) { GPIO_Write(GPIOA,~0x0001); Delay_ms(500); GPIO_Write(GPIOA,~0x0002); Delay_ms(500); GPIO_Write(GPIOA,~0x0004); Delay_ms(500); GPIO_Write(GPIOA,~0x0008); Delay_ms(500); GPIO_Write(GPIOA,~0x00010); Delay_ms(500); GPIO_Write(GPIOA,~0x00020); Delay_ms(500); GPIO_Write(GPIOA,~0x00040); Delay_ms(500); GPIO_Write(GPIOA,~0x00080); Delay_ms(500); } }
分享:

看完干货,该让你的企业上线了

免费需求沟通 · 48 小时内出具建站方案 · 河南本地可上门