Escape Room Cut The Wire puzzle

I am creating a portable escape room and I need help on one of the puzzles I am creating. The concept is that players will need to cut the yellow wire first which will speed up the timer 2x as fast and then they need to cut the green wire to defuse the bomb. If they cut the red or blue wire it will play an explosion noise and cause the bomb to “blow up.” I have the code done and there are no issues with it when I upload it but when I try to use it with my wiring nothing happens. I also have it so that when a microswitch is released the timer will start because the players will only have 5 minutes once they discover the bomb. I know nothing is wrong with my Arduino because I have tried a different code and it works. Something must be wrong with my code or my wiring. If you could help that would be great. Thanks!

Bomb_Puzzle_2.ino (6.77 KB)

What state will an input be in once the wire is cut ?

Hint: make these all INPUT_PULLUP so when the wire is cut the input reads a high. Have the wir connect the pin to Gnd otherwise.

const byte sensorPinRed = 6;
const byte sensorPinYellow = 7;
const byte sensorPinGreen = 8;
const byte sensorPinBlue = 9;

Why are you doing analogRead on those? They are digital inputs:


and again later on:
int red = analogRead(sensorPinRed);
int yellow = analogRead(sensorPinYellow);
int green = analogRead(sensorPinGreen);
int blue = analogRead(sensorPinBlue);

Congraduations? Not a real word: Congratulations.

So things seem a little mixed up.

I have made the changes that you have suggested and it still does not work. I have opened up the serial monitor and it does not change anything when a wire is cut.

Bomb_Puzzle_2.0.ino (6.78 KB)

Please post your code

Your wiring diagram shows pins 8, 9, 10, and 11 being used (red, yellow, green, and blue). Why does your sketch use 6, 7, 8, and 9 (red, yellow, green, and blue)?!?

Please post your code

You mean to say, "Please read the instructions!"

If you post your code according to the instructions in the How to use this forum sticky, more people will look at it.