Hi all im very new to the world of ardunio but am learning slowly so please bear that in mind
so the project is for a escape room prop we have a old rotary phone and thie set up is as follows
using a motion sensor a person is detected and the phone will ring (play track 1 on the mp3 module of a ringing phone ) then when they pick the handset up the switch on the phone is linked to a Digital pin and acts as a normal switch switching the output to LOW (as its set to high when the handset is down ) what i want to do is upon the handset being picked up for it to skip to track 2 "some audio which gives a clue " (this can loop whilst the handset is lifted if thats easyer )
but then for the phone to be about to "reset" ready for the next group of players and start the cycle again ? this is the code i wrote so far but i need help thank you
#include <MD_YX5300.h>
#include "SerialMP3Player.h"
#define TX 11
#define RX 10
int Sensor = 2;
int state = LOW;
int Val = 0;
int Switch =5;
int SwitchVal=1;
const int ResetPin=3;
SerialMP3Player mp3(RX,TX);
void setup() {
Serial.begin(9600); // start serial interface
pinMode (Sensor,INPUT);
pinMode (Switch, INPUT);
pinMode (ResetPin,OUTPUT);
digitalWrite (ResetPin, HIGH);
mp3.begin(9600); // start mp3-communication
delay(500); // wait for init
mp3.sendCommand(CMD_SEL_DEV, 0, 2); //select sd-card
delay(500); // wait for init
}
// the loop function runs over and over again forever
void loop()
{
Val=digitalRead(Sensor);
SwitchVal=digitalRead(Switch);
if (Val=HIGH);
Serial.println ("motion detected ! ") ;
delay (50);
mp3.play();
delay(5000); // wait 10 seconds for answer }
digitalWrite(ResetPin,LOW);
delay (100);
Val=digitalRead(Sensor);
SwitchVal=digitalRead(Switch);
if (Val==HIGH&&SwitchVal==LOW);
mp3.play(002);}