I’m working on a project for a Halloween prop. I’m using a knockoff Arduino from a kit I needed for a class. The Arduino IDE recognizes it as an Arduino Uno. If someone triggers a distance sensor, the jaw of a skull opens and an audio file plays. Here’s the relevant bit of code that controls it all:
if(distance < 10.0){
myservo.write(90);
choice = arrPos;
delay(500);
tmr.play(files[choice].name()); //tmr is the audio object that's connected to pin 9 on my board.
Serial.println(files[choice].name());
Serial.println("playing");
while(tmr.isPlaying()){
Serial.println();
}
myservo.write(180);
delay(500);
arrPos++;
}
Whenever the sensor is triggered for the first time it will move the servo to 90 degrees and play the audio, but the servo won’t move to 180 degrees. It has no problem playing the audio every time the sensor is triggered, nothing happens with the servo. I was wondering if the audio library I’m using interferes with the servo. Feel free to ask me for move of my code/more specific details if I was vague anywhere.