I don’t have a sketch for this project, just doing some thinking before I pullout the keyboard (this is my phone). I was interested in writing a program that uses a predetermined time limit, for instance having a definition like...
#define RUNTIME 30000
So the game runs for 30 seconds. By doing this it would be a simple matter of changing the 30000 to 60000 and uploading to the Arduino.
After thinking about that a while, I would prefer to be able to adjust the time using a selector switch.
So my question is.... if I use a 1p4t (on-on-on-on) rotary selector switch, assign each position to a pin and run 5v to the common. Each pin would defined as RUNTIME and a different time limit, 30000, 60000, 90000, 120000, three pins would be LOW and one HIGH depending on position.
Then using IF and ELSE statements in the loop setup would I be able to switch the times? I know once the Arduino is powered up the selector switch would need to be at the correct location and if you choose to change the “RUNTIME” a reset would need to be pressed.
Thank you for any assistance or ideas.
INPUT_PULLUP
mode for the pins. If you don't you then need to add a pulldown resistor to all 4 inputs.