Skip to content

Number of Button Presses as defined by presses variable #2

@rfarren

Description

@rfarren

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions