I need help with a code.
This code appears to be an implementation of a simple passcode entry system...
ChatGPT did a pretty good job of describing the code it couldn't even remember writing. I recommend that everyone plug some random code in and ask for an analysis. Very spooky.
The problem is that digitalRead reacts when the button is pressed, I need those if statements that the buttons control to trigger only when the button goes down, not because it is being held down.
In that case, you can modify the code to use a state machine...
That works better, but only if I use clean switches with no contact bounce. Can you add some debouncing for both buttons so I can use real switches?
Yes, I can help you add debouncing for both buttons...
(new version. Completely foobar).
You broke it. Now it says "Max attempts" immediately...
I apologize for the mistake. The issue might be that the debouncing delay is too long...
First I ever heard that explanatrion…
(another version, same problem)
No - bouncing isn't the problem because I am still using switches that do not bounce...
I apologize for the mistake. I believe I see the problem.
(Same problem, another version)
I asked it to try again and reminded it of a few things I tought it might be overlooking again.
I apologize for the confusion. I see what the problem is now...
(Same problem)
THX, I will try to fix this myself. You are in over your head it seems.
I'm sorry if my previous suggestions didn't work for you. I understand that debugging code can be a challenging task, especially if you're not familiar with the codebase. If you need further assistance, please feel free to ask, and I'll do my best to help you.
didn't work for you
LOL! Dint work full stop.
So for now my money is on @anon56112670 and the rest of the human race.
a7