Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number of Button Presses as defined by presses variable #2

Open
rfarren opened this issue Jan 21, 2021 · 0 comments
Open

Number of Button Presses as defined by presses variable #2

rfarren opened this issue Jan 21, 2021 · 0 comments

Comments

@rfarren
Copy link

rfarren commented Jan 21, 2021

This is a great sketch, simple and elegant. I am using an ATTiny45 programmed through an Arduino Nano.

The number of presses defined in the variable "presses" is not the number of presses required to trigger speed unlock.
The reason for this is the for loop inside checkCode(int presses). The for loop references i<(presses+1). This results in the user needing to press the button 2 times more than that recorded in the presses variable (the first press occurs before the for loop starts), for both unlock speed and revert speed.

This can be fixed by instead referencing i<(presses-1) in the for loop.

I know I could commit changes and issue a pull request but I haven't checked out the repo and this is a single character fix.

Once the code has been changed the user needs to press 5 times to unlock and 3 times to revert the speed setting as per the variables in the sketch.
The README file also can be updated as currently it references 6 clicks and 3 clicks which is incorrect (it took me ages to find out it was 7 very fast clicks and 5 clicks to revert). Once the fix is in place it will be 5 clicks and 3 clicks and you actually have more time to complete the clicks as the whole operation must be completed in MILLISPERPRESS*presses. It was a challenge to get 7 clicks in under 1.4 seconds - much easier to get 5 clicks in 1.4 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant