You are trying to build a state machine, which can be done with analog
components, but simple with programmable parts, like Arduino.
This is simple implementation of the button logic in code. mBlock takes
your block configuration and converts it to Arduino code and programs
the Arduino. In this case you could use a ATTINY85 as well.
View attachment 137802
You would use an Arduino board. Or Use an Arduino board to program the ATTINY85.
Lots of fun, kids using it in 6'th grade to program robots.
Nano board :
View attachment 137803
View attachment 137804
Regards, Dana.