Closed GHBLoos closed 3 years ago
Hi,
Since I don't have your hardware, I can only guess. But I'm pretty sure that it's not AceButton, it's been used and tested by too many people to have a fundamental bug like this. It's probably something to do with the CapacitiveSensor library and how it behaves when you keep touching it, and what it does when it reaches its TIMEOUT_MILLIS
. Something is causing it to behave as though you are touching it and releasing it rapidly, over 10-20 milliseconds, which causes AceButton to think that you are clicking and double clicking.
You will have difficulty debugging this with all the extra cruft in your code. What you should do is to create a new program, and strip this down to the bare essence, removing everything that does not involve AceButton or CapacitiveSensor. Then insert some print statements inside the CapacitiveSensor.capacitiveSensor()
function, and figure out why it thinks you are touching and removing your finger on the switch.
I'm going to close this, since it does not seem like a bug in AceButon.
I am using the capacitive button as a switch to control a smart light. The problem is that the released occurs while not expected. I don't understand why and whether this is AceButton related or CapacitiveSensor related.
Hardware
Problem When touching and holding the metal strip I expect that the buttonevent is pressed. To see what event occurs, I addds a
Serial.Println
withmillis()
and theeventType
. The monitor shows:So while I expected to only see a pressed, I also see a released, and because of that also clicked and doubleClicked.
I am not sure why this occurs:
Code The code is used to function as a smart (led) light, which is controlled by diyHue https://diyhue.github.io/. This light has a touch button to switch the light on or off.
The full code is below (based upon https://github.com/diyhue/Lights/tree/master/Arduino/Generic_SK6812_Strip, by Marius Motea).