int main(void)
{
#ifdef DEBUG
debug();
#endif
vu32 i = 1;
GPIO_InitTypeDef GPIO_InitStructure; //GPIO 状态恢复默认
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB , ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; //管脚位置定义,标号可
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//输出速度50MHz
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);//B 组GPIO 初始化
/* Infinite loop */
while (1)
{
i++;
sleep(10000);
GPIO_ResetBits(GPIOB,GPIO_Pin_3);
if(i%2 == 0)
GPIO_WriteBit(GPIOB,GPIO_Pin_3,(BitAction)0x01);
else{
GPIO_WriteBit(GPIOB,GPIO_Pin_3,(BitAction)0x00);
}
}
}
我想让灯一闪一闪的,sleep就是一个循环
void sleep(vu32 ncount)
{
for(; ncount != 0; ncount--);
}
我是直接生成hex文件,然后用j flash刷进去的。灯一直不亮。是不是程序有问题呢
我要赚赏金
