STM32-LED灯闪烁

复制代码
#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_8;
    GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
    
    GPIO_Init(GPIOA,&GPIO_InitStructure);
    //GPIO_SetBits(GPIOA,GPIO_Pin_8);
    //GPIO_ResetBits(GPIOA,GPIO_Pin_8);
    GPIO_WriteBit(GPIOA,GPIO_Pin_8,Bit_RESET);
    while (1)
    {    
        GPIO_WriteBit(GPIOA,GPIO_Pin_8,Bit_RESET);
        Delay_s(5);
        GPIO_WriteBit(GPIOA,GPIO_Pin_8,Bit_SET);
        Delay_s(5);

      /*
      GPIO_ResetBits(GPIOA,GPIO_Pin_8);//re=0
      Delay_ms(500);
      GPIO_SetBits(GPIOA,GPIO_Pin_8);
      Delay_ms(500);
      */


    }
}
复制代码

 

posted @   遥远的死神  阅读(60)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」
点击右上角即可分享
微信分享提示