That's great - thanks. I'm glad to have that working with this improved code, and I will use that form going forward.
The servo moves to its starting position ('locked') when the program loads,
but when I complete the LED sequence, it doesn't move at all.
The condition of
turn==OPEN_CNT
is being fulfilled (turn = 4), which I can confirm because I get the victory 'cheer' from the speakers, and because I see the Serial.println confirmation in the serial monitor ('The box is unlocked!').
So of this section of code
Serial.println("\n Simon Says Open the Lock ");
playCheer();
delay(500); // brief pause before unlocking
// move the servo to the unlocked position
myServo.write(2000);
// print out status
Serial.println("The box is unlocked!");
only the servo movement doesn't work.
I've tried swapping servos, and I even tested the movement by instructing it to re-position right at the start:
// SERVO SETUP
// attach the servo to pin 9
myServo.attach(9);
// INITIALIZATION SERVO TO CLOSED
// move the servo to the locked position
myServo.write(1000);
delay(2000);
myServo.write(2000);
delay(100);
and that works, so it looks like the parameters are ok. It just won't move from the instructions in the void loop section.
I'm new to coding with the Arduino, and I wondered if my instruction there could be mistakenly bundled with the preceding comment ('// brief pause before unlocking'), so that it doesn't get executed, but when I try moving the line down, it still doesn't activate. It sure looks like the same format as the initial instruction. I wonder what's missing?