#include "stm32f10x.h" // Device header
#include "Delay.h"
int main(void)
{
// 1. 使能GPIOA时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
// 2. 配置GPIOA的PA0引脚
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; // 配置为推挽输出模式
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All; // 选择PA0引脚
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // 设置输出速度为50MHz
GPIO_Init(GPIOA, &GPIO_InitStructure); // 初始化GPIOA的PA0引脚
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);
}
}
版权属于:离
作品采用《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权