Open patfelst opened 1 month ago
Hello, @patfelst
Sorry for the late reply.
Are you running the M5.update();
function properly?
Calling this function will update the state of all buttons, so you must call it once before reading the button state. If you do not call it or call it more than once, the state will not be updated correctly.
thanks, I will check this soon!
Hi there, I'm using an M5AtomS3. I need to execute some code only once, about 1500ms after BtnA has been released after being held for some time. When I use
if (M5.BtnA.releasedFor(1500))
, it does become true 1500ms after being released, but then remains true forever so the code is also executed forever. Is there a way to reset this button status, or do I need to add my own boolean flag to keep track of when the code has been executed so that it only happens once?Also if I try
if (M5.BtnA.wasReleaseFor(1500))
it never seems to be true.Here is my code:
The following code works but is not as neat as using built in M5 functions
thanks for any suggestions!