A little two-bit state machine decides which code is required to enter the next state. The fourth state equals to the lock being open. A wrong code in any state resets to the first state.
To test the project, refer to its Wokwi, which is public.
# | Input | Output |
---|---|---|
0 | unused | lock status |
1 | reset | unused |
2 | enter | unused |
3 | code digit 0 | unused |
4 | code digit 1 | unused |
5 | code digit 2 | unused |
6 | code digit 3 | unused |
7 | code digit 4 | unused |