So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By buzzy
#78264
PatrykW wrote:Mate, you want to do some debouncing there. Connections never perfect and virtually everything has some electrical charge. Try using this:
https://github.com/thomasfredericks/Bounce2
Works for me like a charm :)


I will try the debounce lib that you linked. I doubt that it will work though, as there is no logic to debounce on. If it just went from LOW to HIGH very quickly a couple of times and ended on HIGH, that would be fine, because there is a "logic" to that. But in my case, the PIN just randomly switches between LOW and HIGH when I touch it. Almost like was floating. Also, the lib that you sent does not seem to be using interrupts, which is bad in my opinion. Checking the PIN-status in every loop is "bad" coding. An interrupt should be used that only triggers when there is a status-change on a PIN. Then the debounce code should be put there.
User avatar
By rudy
#78265
You mentioned an RC delay? What is that? Could you please elaborate some more.


I never have input pins connected directly to wire outside the product. I would have a pull up resistor, say 1K, then 10K between the 1K resistor and the input. And from the input to ground I use a small capacitor. Sometimes 0.1uF, but it depends on how quickly I need to respond to the change on the input.

Layout of the wiring is also important. Usually in a case like your's I ask to see a picture of the setup. To see what might be possible causes.
User avatar
By buzzy
#78266
rudy wrote:
You mentioned an RC delay? What is that? Could you please elaborate some more.


I never have input pins connected directly to wire outside the product. I would have a pull up resistor, say 1K, then 10K between the 1K resistor and the input. And from the input to ground I use a small capacitor. Sometimes 0.1uF, but it depends on how quickly I need to respond to the change on the input.

Layout of the wiring is also important. Usually in a case like your's I ask to see a picture of the setup. To see what might be possible causes.


I really appreciate your help! What you are saying makes sense and I will try it :)
I am currently uploading a video where I film my entire (weird) experience. I will post the link as soon as it's done. It's only 3 minutes long, but my upload speed is slow. Seems like you will be the correct person to help me guide through this (to me) completely crazy experience :)