This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您需要使用计时器来设置非阻塞延迟。 我使用 SysTick 设置 Arduino 类似的"Millis"函数。 然后、当我看到按钮按压操作时、我会存储按压操作的起始时间。 在一段时间过去后(我的樱桃按钮15毫秒左右),我然后注册按钮按压。
在 pseduocode 中类似于以下内容:
if (按下按钮1)
那么
if (button1start == 0)
那么
button1start = Millis ();如果 button1start =0、则 button1start = 1;//如果 Millis 恰好为0!
否则
if (Millis()- button1start > 15)
然后注册按键
字节序
字节序