int main(void)
{ delay_init(168);
led_init();
while(1)
{ if ((GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0 ))|(GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_2 ))|(GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_3 ))|(GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_4 )))
{
if (GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_2))GPIO_SetBits(GPIOF,GPIO_Pin_8 );
else if (GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_3))GPIO_ResetBits(GPIOF,GPIO_Pin_9 );
else if (GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_4))GPIO_ResetBits(GPIOF,GPIO_Pin_10 );
else if (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0))GPIO_ResetBits(GPIOF,GPIO_Pin_9 |GPIO_Pin_10);
}
else {GPIO_ResetBits(GPIOF,GPIO_Pin_8 );GPIO_SetBits(GPIOF,GPIO_Pin_9 |GPIO_Pin_10);}
}
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>