5172| 19
|
一个按键按下led1亮,松开后再次按下led1灭?程序怎么写? |
1金钱
最佳答案[mw_shl_code=c,true] while (1)
{
if(HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_4)==0)//KEY1
{
delay_ms(100);
if(HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_4)==0)//KEY1
{
if(HAL_GPIO_ReadPin(GPIOF, GPIO_PIN_11))
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_11, GPIO_PIN_RESET);
else
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_11,GPIO_PIN_SET);
}
}
}[/mw_shl_code]
麻烦低级但实测可 ...
| ||
| ||
| ||
| ||
| ||
我的开源链接 https://github.com/ShuifaHe/STM32.git 请关注,点赞支持哦。
|
||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
虽然不明白你们在说什么,但感觉很厉害的样子。
|
||
| ||
虽然不明白你们在说什么,但感觉很厉害的样子。
|
||
|手机版|OpenEdv-开源电子网
( 粤ICP备12000418号-1 )
GMT+8, 2025-6-8 05:49
Powered by OpenEdv-开源电子网
© 2001-2030 OpenEdv-开源电子网