Hello!
I would like to make an escape room, and for one of the stages, I want to have a wire cut stage. Five wires have to be cut in the right order, and if the right wire is cut, it will trigger a green LED, and a red LED if the wrong wire is cut. I'm having some trouble with this and it just turns on all the green LEDs and the red LED. Why does this happen?
Code: Github Gist https://gist.github.com/physiks2017/75b71a72f31e69e30eb80717dd0e3841
Code I think is problematic:
while (one == true)
{
// see if all of the wires are connected
if (digitalRead(bluePin == HIGH))
{
// turn on the green LED
digitalWrite(gled1Pin, HIGH);
// see if rest of wires are connected
if (digitalRead(orangePin == HIGH))
{
// turn on second green LED
digitalWrite(gled2Pin, HIGH);
if (digitalRead(greenPin == HIGH))
{
// turn third LED on
digitalWrite(gled3Pin, HIGH);
// see if rest of wires are connected
if (digitalRead(whitePin == HIGH))
{
// turn on fourth LED
digitalWrite(gled4Pin, HIGH);
// see if the rest of the wires are connected
if (digitalRead(yellowPin == HIGH))
{
// turn on last green LED
digitalWrite(gled5Pin, HIGH);
// pause three seconds
delay(3000);
// turn off green LEDs
digitalWrite(bled1Pin, LOW);
digitalWrite(bled2Pin, HIGH);
digitalWrite(gled1Pin, LOW);
digitalWrite(gled2Pin, LOW);
digitalWrite(gled3Pin, LOW);
digitalWrite(gled4Pin, LOW);
digitalWrite(gled5Pin, LOW);
two = true;
one = false;
pinMode (orangePin, INPUT_PULLUP);
pinMode (yellowPin, INPUT_PULLUP);
pinMode (whitePin, INPUT_PULLUP);
pinMode (greenPin, INPUT_PULLUP);
My Wires are connected straight from ground and the pull ups are enabled, since I assumed that when they were cut they would read HIGH