Click here to Skip to main content
15,667,466 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
so i have a button. doesn't matter, it's some ir remote through arduino to python.

the button when pressed, it outputs a string like "FF260"
the problem is that when it is held, it first outputs a string like that, then spams "FFFF"
how do i make it so after doing FF260, i detect if it keeps outputting FFFF to know it is being held?

What I have tried:

can't think of a solution, i tried nothing
Updated 17-Apr-23 3:59am

1 solution

At FF260 the button is 'pressed'.
In such a state wait (with an appropriate timeout) for FFFF then
  • if you receive it then the button is currently 'held' and your code should wait again
on the other hand
  • if the timeout expires then the button is 'released'
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900