haunted house

A Haunted house project looking to do the following things

Have 14 pins all outs + 15 in have 8 sound bytes on pins 1 to 8 have four pins to switch relays, four rooms speakers have two pins to switch play + amp on

so the scenaryo is aduino reads 1 to 8 inputs if a pin low play that event 1 to 8 if more than 1 switch low play in random sequence all sound bytes with pins low till pin 9 is low/high (end of Play)

also read 10 to 13 if one is low utput to 1 pin if 2 are low output to 2 pins if 3 out to 3 pins if 4 then out to all 4 if pin 15 input is low then random 1 to 4 together

all the these output events need to have a master play with a random time between 3 to 30 min between activation

have not done any programing since I had a dragon 64 way way back so starting from scratch have had some good help from this forum with a random timer,which I am about to start to tinker with. so is there anyone able to help with this Thanks Terry

What Arduino do you have?

14 out + 15 in = 29 => MEGA?

What do you mean with "have 8 sound bytes on pins 1 to 8" ? The Arduino cannot process audio very well.

so the scenaryo is aduino reads 1 to 8 inputs if a pin low play that event 1 to 8 if more than 1 switch low play in random sequence all sound bytes with pins low till pin 9 is low/high (end of Play)

also read 10 to 13 if one is low utput to 1 pin if 2 are low output to 2 pins if 3 out to 3 pins if 4 then out to all 4 if pin 15 input is low then random 1 to 4 together

This is not very clear to me but you have a very clear picture I guess. Can you write this in code?

if (digitalRead(1) == LOW && digitalRead(15) == LOW)
{
  // do something...
}

have a mp3 trigger when it arrives with 8 files yes a mega 2560

have a mp3 trigger when it arrives with 8 files yes a mega 2560

you mean: you have a mp3 player with 8 sound tracks and depending on which pin is changed (HIGH) one of the 8 will be played???

Please try to formulate your requirements as clear as possible

here is a crude start as I say long time since playing with programing more done some snipets added

[code]{
int SoundOutA = 2; //play sound 1
int SoundOutB = 3; //play sound 2
int SoundOutC = 4; //play sound 3
int SoundOutD = 5; //play sound 4
int SoundOutE = 6; //play sound 5
int SoundOutF = 7; //play sound 6
int SoundOutG = 8; //play sound 7
int SoundOutH = 9; //play sound 8
int PlayOutA = 10; //Play this may be power on relay
int AmpOnOutA = 11; //Amplfier On relay
int SpeakOutA = 12; //speaker 1 relay
int SpeakOutB = 13; //speaker 2 relay
int SpeakOutC = 22; //speaker 3 relay
int SpeakOutD = 24; //speaker 4 relay
int StopOutA = 26; //Stop
int SwitchInputA = 31; //Switch sound 1
int SwitchInputB = 33; //Switch sound 2
int SwitchInputC = 35; //Switch sound 3
int SwitchInputD = 37; //Switch sound 4
int SwitchInputE = 39; //Switch sound 5
int SwitchInputF = 41; //Switch sound 6
int SwitchInputG = 43; //Switch sound 7
int SwitchInputH = 45; //Switch sound 8
int SpeakerConA = 47; //speaker config 1 this configs for 2 rooms
int SpeakerConB = 49; //speaker config 2 this configs for 4 rooms
int SpeakerConC = 51; //speaker config 3 thia configs all speakers in a random sequence 1 after the other
int LightSensA = 53; //Light Senser is it dark so begin


long randOff = 0;                 // Initialize a variable for the OFF time


void setup()                      // run once, when the sketch starts
{
randomSeed (analogRead (0));    // randomize


  pinMode(SoundoutA 2, OUTPUT);   //sound 1  
  pinMode(SoundoutB 3, OUTPUT);   //sound 2
  pinMode(SoundoutC 4, OUTPUT);   //sound 3
  pinMode(SoundoutD 5, OUTPUT);   //sound 4
  pinMode(SoundoutE 6, OUTPUT);   //sound 5
  pinMode(SoundoutF 7, OUTPUT);   //sound 6
  pinMode(SoundoutG 8, OUTPUT);   //sound 7
  pinMode(SoundoutH 9, OUTPUT);   //sound 8
  pinMode(PlayOutA 10, OUTPUT);   //play
  pinMode(AmpOnOutA 11, OUTPUT);   //amp on
  pinMode(SpeakOutA 12, OUTPUT);   //speaker 1
  pinMode(SpeakOutB 13, OUTPUT);   //speaker 2
  pinMode(SpeakOutC 22, OUTPUT);   //speaker 3
  pinMode(SpeakOutD 24, OUTPUT);   //speaker 4
  pinMode(StopOutA 26, OUTPUT);   //stop
  pinMode(SwitchInputA 31, INPUT);  //switch 1
  pinMode(SwitchInputB 33, INPUT);  //switch 2
  pinMode(SwitchInputC 35, INPUT);  //switch 3
  pinMode(SwitchInputD 37, INPUT);  //switch 4
  pinMode(SwitchInputE 39, INPUT);  //switch 5
  pinMode(SwitchInputF 41, INPUT);  //switch 6
  pinMode(SwitchInputG 43, INPUT);  //switch 7
  pinMode(SwitchInputH 45, INPUT);  //switch 8
  pinMode(SpeakerConA 47, INPUT);  //speaker 1 on
  pinMode(SpeakerConB 49, INPUT);  //speaker 2 on
  pinMode(SpeakerConC 51, INPUT);  //speaker 3 on
  pinMode(SpeakerConD 53, INPUT);  //Light senser
} 
  
if (digitalRead(27) == LOW && digitalRead(34) == LOW)
{
  // pick sound turn on play and amp on 
}
if (digitalRead(35) == LOW && digitalRead(38) == LOW)
(
// choose speakers or rooms if switch 1then on 2 rooms if switch 2 then 4 rooms if switch 3 then one room at random if light on all off
)

// when sounds finish start random timer 3 to 30 minutes then on again till play complete then loop
// if light on stop play or amp

[/code]

Assign meaningful names to the pin numbers, and reference them in the code. Life will be a lot easier. Trust me.

Why are the speaker pins INPUT? I don't believe anyone has ever successfully read anything from a speaker. You aren't using a microphone as output, are you? Or, what does "speaker 1 on" mean?

assigned name etc some desciptive txt as you say easyer to follow in the end think I have

ssigned name etc some desciptive txt as you say easyer to follow in the end think I have

But, that code no longer compiles.

int SoundOutA = 2; //play sound 1
  pinMode(SoundoutA 2, OUTPUT);   //sound 1

The " 2" doesn't belong there, and the case of names is important.

here is an update still strugling but how does it look so far work in progress

int SoundOutA = 2; //play sound 1
int SoundOutB = 3; //play sound 2
int SoundOutC = 4; //play sound 3
int SoundOutD = 5; //play sound 4
int SoundOutE = 6; //play sound 5
int SoundOutF = 7; //play sound 6
int SoundOutG = 8; //play sound 7
int SoundOutH = 9; //play sound 8
int PlayOutA = 10; //Play this may be power on relay
int AmpOnOutA = 11; //Amplfier On relay
int SpeakOutA = 12; //speaker 1 relay
int SpeakOutB = 13; //speaker 2 relay
int SpeakOutC = 22; //speaker 3 relay
int SpeakOutD = 24; //speaker 4 relay
int StopOutA = 26; //Stop
int SwitchInputA = 31; //Switch sound 1
int SwitchInputB = 33; //Switch sound 2
int SwitchInputC = 35; //Switch sound 3
int SwitchInputD = 37; //Switch sound 4
int SwitchInputE = 39; //Switch sound 5
int SwitchInputF = 41; //Switch sound 6
int SwitchInputG = 43; //Switch sound 7
int SwitchInputH = 45; //Switch sound 8
int SpeakerConA = 47; //speaker config 1 this configs for 2 rooms
int SpeakerConB = 49; //speaker config 2 this configs for 4 rooms
int SpeakerConC = 51; //speaker config 3 thia configs all speakers in a random sequence 1 after the other
int LightSensA = 53; //Light Senser is it dark so begin


long randOff = 0;                 // Initialize a variable for the OFF time


void setup()                      // run once, when the sketch starts
{
randomSeed (analogRead (0));    // randomize


  pinMode(SoundOutA, OUTPUT);   //sound 1  
  pinMode(SoundOutB, OUTPUT);   //sound 2
  pinMode(SoundOutC, OUTPUT);   //sound 3
  pinMode(SoundOutD, OUTPUT);   //sound 4
  pinMode(SoundOutE, OUTPUT);   //sound 5
  pinMode(SoundOutF, OUTPUT);   //sound 6
  pinMode(SoundOutG, OUTPUT);   //sound 7
  pinMode(SoundOutH, OUTPUT);   //sound 8
  pinMode(PlayOutA, OUTPUT);   //play
  pinMode(AmpOnOutA, OUTPUT);   //amp on
  pinMode(SpeakOutA, OUTPUT);   //speaker 1
  pinMode(SpeakOutB, OUTPUT);   //speaker 2
  pinMode(SpeakOutC, OUTPUT);   //speaker 3
  pinMode(SpeakOutD, OUTPUT);   //speaker 4
  pinMode(StopOutA, OUTPUT);   //stop
  pinMode(SwitchInputA, INPUT);  //switch 1
  pinMode(SwitchInputB, INPUT);  //switch 2
  pinMode(SwitchInputC, INPUT);  //switch 3
  pinMode(SwitchInputD, INPUT);  //switch 4
  pinMode(SwitchInputE, INPUT);  //switch 5
  pinMode(SwitchInputF, INPUT);  //switch 6
  pinMode(SwitchInputG, INPUT);  //switch 7
  pinMode(SwitchInputH, INPUT);  //switch 8
  pinMode(SpeakerConA, INPUT);  //speaker 1 on
  pinMode(SpeakerConB, INPUT);  //speaker 2 on
  pinMode(SpeakerConC, INPUT);  //speaker 3 on
  pinMode(LightSensA, INPUT);  //Light senser
} 
 void loop()                       // run over and over again scan inputs then play them

{

 randOff = random (2000, 9000);    // generate OFF time between 2 and 9 seconds
   if (digitalRead(SwitchInputA) == LOW);
   {
   digitalWrite(SoundOutA, HIGH);   // sets the sound 1 on 
   digitalWrite(PlayOutA, HIGH);    // sets the Play on
   digitalWrite(AmpOnOutA, HIGH);    // sets the AMP on
   }
   if (digitalRead(SwitchInputA) == HIGH);
   if (digitalRead(LightSensA) == LOW);
   {
   digitalWrite(SoundOutA, LOW);   // sets the sound 1 off 
   digitalWrite(PlayOutA, LOW);    // sets the Play off
   digitalWrite(AmpOnOutA, LOW);    // sets the AMP off
   
   
   delay(randOff);               // waits for a random time while OFF
   }
   {
 // choose speakers or rooms if switch 1 then on 2 rooms if switch 2 then 4 rooms if switch 3 then one room at random if lights on all off


if (digitalRead(SpeakerConA) == LOW && digitalRead(SpeakerConC) == LOW);

{

  




// when sounds finish start random timer 3 to 30 minutes then on again till play complete then loop
// if light on stop play or amp
   if (digitalRead(SwitchInputA) == HIGH);

If you are not going to do anything (; is a no-op. i.e. does nothing), why bother checking?

   if (digitalRead(LightSensA) == LOW);
   {
   digitalWrite(SoundOutA, LOW);   // sets the sound 1 off 
   digitalWrite(PlayOutA, LOW);    // sets the Play off
   digitalWrite(AmpOnOutA, LOW);    // sets the AMP off
   
   
   delay(randOff);               // waits for a random time while OFF
   }

Ditto here. The block of code defined by the { and } is unconditionally executed.

if (digitalRead(SpeakerConA) == LOW && digitalRead(SpeakerConC) == LOW);

I hate to repeat myself, but ditto here, too.

In short don't put a colon at the end of an if() unless you know you want that if() to be ignored.

It is still not clear what is actually going to produce the sound, I will tell you something for nothing, it's not the arduino.

thanks will look at that sound a mp3 triggerv v2

Ok looked at it again still got to get a random sequenceal play when more than 1 track sellected (Shuffle tracks) and (shuffle room/Speakers)

[code]
int SoundOutA = 2; //play sound 1
int SoundOutB = 3; //play sound 2
int SoundOutC = 4; //play sound 3
int SoundOutD = 5; //play sound 4
int SoundOutE = 6; //play sound 5
int SoundOutF = 7; //play sound 6
int SoundOutG = 8; //play sound 7
int SoundOutH = 9; //play sound 8
int PlayOutA = 10; //Play this may be power on relay
int AmpOnOutA = 11; //Amplfier On relay
int SpeakOutA = 12; //speaker 1 relay
int SpeakOutB = 13; //speaker 2 relay
int SpeakOutC = 22; //speaker 3 relay
int SpeakOutD = 24; //speaker 4 relay
int StopOutA = 26; //Stop
int SwitchInputA = 31; //Switch sound 1
int SwitchInputB = 33; //Switch sound 2
int SwitchInputC = 35; //Switch sound 3
int SwitchInputD = 37; //Switch sound 4
int SwitchInputE = 39; //Switch sound 5
int SwitchInputF = 41; //Switch sound 6
int SwitchInputG = 43; //Switch sound 7
int SwitchInputH = 45; //Switch sound 8
int SpeakerConA = 47; //speaker config 1 this configs for 2 rooms
int SpeakerConB = 49; //speaker config 2 this configs for 4 rooms
int SpeakerConC = 51; //speaker config 3 thia configs all speakers in a random sequence 1 after the other
int LightSensA = 53; //Light Senser is it dark so begin
int SpeakVar = 0;

long randOff = 0;                 // Initialize a variable for the OFF time


void setup()                      // run once, when the sketch starts
{
randomSeed (analogRead (0));    // randomize


  pinMode(SoundOutA, OUTPUT);   //sound 1  
  pinMode(SoundOutB, OUTPUT);   //sound 2
  pinMode(SoundOutC, OUTPUT);   //sound 3
  pinMode(SoundOutD, OUTPUT);   //sound 4
  pinMode(SoundOutE, OUTPUT);   //sound 5
  pinMode(SoundOutF, OUTPUT);   //sound 6
  pinMode(SoundOutG, OUTPUT);   //sound 7
  pinMode(SoundOutH, OUTPUT);   //sound 8
  pinMode(PlayOutA, OUTPUT);   //play
  pinMode(AmpOnOutA, OUTPUT);   //amp on
  pinMode(SpeakOutA, OUTPUT);   //speaker 1
  pinMode(SpeakOutB, OUTPUT);   //speaker 2
  pinMode(SpeakOutC, OUTPUT);   //speaker 3
  pinMode(SpeakOutD, OUTPUT);   //speaker 4
  pinMode(StopOutA, OUTPUT);   //stop
  pinMode(SwitchInputA, INPUT);  //switch 1
  pinMode(SwitchInputB, INPUT);  //switch 2
  pinMode(SwitchInputC, INPUT);  //switch 3
  pinMode(SwitchInputD, INPUT);  //switch 4
  pinMode(SwitchInputE, INPUT);  //switch 5
  pinMode(SwitchInputF, INPUT);  //switch 6
  pinMode(SwitchInputG, INPUT);  //switch 7
  pinMode(SwitchInputH, INPUT);  //switch 8
  pinMode(SpeakerConA, INPUT);  //speaker 1 on
  pinMode(SpeakerConB, INPUT);  //speaker 2 on
  pinMode(SpeakerConC, INPUT);  //speaker 3 on
  pinMode(LightSensA, INPUT);  //Light senser
} 
 void loop()                       // run over and over again scan inputs then play them

{
 SpeakVar = random (1,5);
 randOff = random (2000, 9000);    // generate OFF time between 2 and 9 seconds
   if (digitalRead(SwitchInputA) == LOW)
   {
   digitalWrite(SoundOutA, HIGH);   // sets the sound 1 on 
   digitalWrite(PlayOutA, HIGH);    // sets the Play on
   digitalWrite(AmpOnOutA, HIGH);    // sets the AMP on
   }
   if (digitalRead(SwitchInputA) == HIGH)
   {
   digitalWrite(SoundOutA, LOW);   // sets the sound 1 off 
   digitalWrite(PlayOutA, LOW);   // sets the Play off
   digitalWrite(AmpOnOutA, LOW);   // sets the AMP off
   }
   if (digitalRead(LightSensA) == LOW) // if light on stop play or amp
   {
   digitalWrite(SoundOutA, LOW);   // sets the sound 1 off 
   digitalWrite(PlayOutA, LOW);   // sets the Play off
   digitalWrite(AmpOnOutA, LOW);   // sets the AMP off
   if (digitalRead(SpeakerConA) == LOW && digitalRead(SpeakerConC) == LOW) // choose speakers or rooms if switch 1 then on 2 rooms if switch 2 then 4 rooms if switch 3 then one room at random if lights on all off
{
  
  digitalWrite(SpeakOutA, HIGH); 
  digitalWrite(SpeakOutC, HIGH);

}
   // when sounds finish start random timer 3 to 30 minutes then on again till play complete then loop

   delay(randOff);               // waits for a random time while OFF
   }}

[/code]

can someone please scan this for me and tell me where there are problems,
would like some help
Thanks

#include <Time.h>
#include <TimeAlarms.h>
//  Some macros for defining time intervals in milliseconds
// #define seconds_in_ms(s) ((s)*1000UL)
// #define minutes_in_ms(m) ((m)*60UL*1000UL)
/* Haunted house  
 possibly 8 events one at a time or more than 1 played random but one after the other like shuffle them then play them back to back but only the number equeal to inputs
 turn on and off a play relay
 turn on and off a stop relay
 turn on and off a amplifier
 then have 4 rooms each with a speaker to be turned on eather in 1 room or 2 rooms or 4 rooms or 4 rooms 1 at a time in shuffle again
 then stop and  wait for a random time between start of between 3 to 30 minute before doing it again
 so if 1 input then  event 1 + play + amp
 if 2 input then event 1 + play + amp folowed by event 2 + play + amp
 if input greater than 2 then play + amp + events shuffled and then played after each other
 rooms if choice 1 then room 1
 rooms if 2 then 2 rooms
 rooms if choice 3 then 4 rooms shuffle then each after each other
 hope this makes sense
 */
int SoundOutA = 2; //play sound 1
int SoundOutB = 3; //play sound 2
int SoundOutC = 4; //play sound 3
int SoundOutD = 5; //play sound 4
int SoundOutE = 6; //play sound 5
int SoundOutF = 7; //play sound 6
int SoundOutG = 8; //play sound 7
int SoundOutH = 9; //play sound 8
int SpeakOutA = 10; //speaker 1 relay
int SpeakOutB = 11; //speaker 2 relay
int SpeakOutC = 12; //speaker 3 relay
int SpeakOutD = 13; //speaker 4 relay
int PlayOutA = 22; //Play this may be power on relay
int AmpOnOutA = 24; //Amplfier On relay
int StopOutA = 26; //Stop
int SwitchInputA = 31; //Switch sound 1
int SwitchInputB = 33; //Switch sound 2
int SwitchInputC = 35; //Switch sound 3
int SwitchInputD = 37; //Switch sound 4
int SwitchInputE = 39; //Switch sound 5
int SwitchInputF = 41; //Switch sound 6
int SwitchInputG = 43; //Switch sound 7
int SwitchInputH = 45; //Switch sound 8
int SpeakerConA = 47; //speaker config 1 this configs for 2 rooms
int SpeakerConB = 49; //speaker config 2 this configs for 4 rooms
int SpeakerConC = 51; //speaker config 3 thia configs all speakers in a random sequence 1 after the other
int LightSensA = 53; //Light Senser is it dark so begin
int SpeakVar = 0;
int SoundPlay = 0;
int ran;
int buttonState;
int buttonState1;
int buttonState2;
int time4 = 4500;


long RandOff = 0;                 // Initialize a variable for the OFF time
long previousMillis = 0;
long interval = 1000;
void randomTimer(){
  int period = random(5000,20000);             // get a new random period 
  Alarm.timerOnce(period, randomTimer);  // trigger for another random period 
}

void setup()                      // run once, when the sketch starts
{
  Serial.begin(9600);


  pinMode(SoundOutA, OUTPUT);   //sound 1  
  pinMode(SoundOutB, OUTPUT);   //sound 2
  pinMode(SoundOutC, OUTPUT);   //sound 3
  pinMode(SoundOutD, OUTPUT);   //sound 4
  pinMode(SoundOutE, OUTPUT);   //sound 5
  pinMode(SoundOutF, OUTPUT);   //sound 6
  pinMode(SoundOutG, OUTPUT);   //sound 7
  pinMode(SoundOutH, OUTPUT);   //sound 8
  pinMode(PlayOutA, OUTPUT);   //play
  pinMode(AmpOnOutA, OUTPUT);   //amp on
  pinMode(SpeakOutA, OUTPUT);   //speaker 1
  pinMode(SpeakOutB, OUTPUT);   //speaker 2
  pinMode(SpeakOutC, OUTPUT);   //speaker 3
  pinMode(SpeakOutD, OUTPUT);   //speaker 4
  pinMode(StopOutA, OUTPUT);   //stop
  pinMode(SwitchInputA, INPUT);  //switch 1
  pinMode(SwitchInputB, INPUT);  //switch 2
  pinMode(SwitchInputC, INPUT);  //switch 3
  pinMode(SwitchInputD, INPUT);  //switch 4
  pinMode(SwitchInputE, INPUT);  //switch 5
  pinMode(SwitchInputF, INPUT);  //switch 6
  pinMode(SwitchInputG, INPUT);  //switch 7
  pinMode(SwitchInputH, INPUT);  //switch 8
  pinMode(SpeakerConA, INPUT);  //speaker 1 on
  pinMode(SpeakerConB, INPUT);  //speaker 2 on
  pinMode(SpeakerConC, INPUT);  //speaker 3 on
  pinMode(LightSensA, INPUT);  //Light senser
} 

void loop()                       // run over and over again scan inputs then play them

{
  randomSeed (analogRead (0));    // randomize
  SoundPlay = random (1,10);  // generate random output pin

  RandOff = random (2000,30000);    // generate OFF time between 2 and 9 seconds in this case 20 to 30 seconds till proved

  unsigned long currentMillis = millis();

  digitalWrite(SpeakOutA, LOW);
  digitalWrite(SpeakOutB, LOW);
  digitalWrite(SpeakOutC, LOW);
  digitalWrite(SpeakOutD, LOW);
  digitalWrite(SoundOutA, LOW); //play sound 1
  digitalWrite(SoundOutB, LOW); //play sound 2
  digitalWrite(SoundOutC, LOW); //play sound 3
  digitalWrite(SoundOutD, LOW); //play sound 4
  digitalWrite(SoundOutE, LOW); //play sound 5
  digitalWrite(SoundOutF, LOW); //play sound 6
  digitalWrite(SoundOutG, LOW); //play sound 7
  digitalWrite(SoundOutH, LOW); //play sound 8

if (digitalRead(SpeakerConA) == HIGH && digitalRead(SpeakerConB) == LOW) // choose speakers, this works on its one but not with the random light below
  {
    digitalWrite(SpeakOutA, HIGH);
    Alarm.delay(time4);
  }
  else
  {
    digitalWrite(SpeakOutA, LOW);
  }
  if (digitalRead(SpeakerConA) == LOW && digitalRead(SpeakerConB) == HIGH) // choose speakers, this works on its one but not with the random light below
  {
    digitalWrite(SpeakOutA, HIGH);
    digitalWrite(SpeakOutB, HIGH);
  }
  else

  {
    digitalWrite(SpeakOutA, LOW);
    digitalWrite(SpeakOutB, LOW);
  }
  if (digitalRead(SpeakerConA) == HIGH && digitalRead(SpeakerConB) == HIGH)
  {
    digitalWrite(SpeakOutA, HIGH);
    digitalWrite(SpeakOutB, HIGH);
    digitalWrite(SpeakOutC, HIGH);
    digitalWrite(SpeakOutD, HIGH);
  }
  else
  {
    digitalWrite(SpeakOutA, LOW);
    digitalWrite(SpeakOutB, LOW);
    digitalWrite(SpeakOutC, LOW);
    digitalWrite(SpeakOutD, LOW);
  }

Code to long to post here is the second half of above code Thanks

 buttonState = digitalRead(SpeakerConC); // random speaker this works when only this in here
  if (buttonState == HIGH)
  {
    ran = random(1, 5);
    if (ran == 1)
    {
      digitalWrite (SpeakOutA, HIGH);
      Alarm.delay (time4);
    }
    else
    {
      digitalWrite (SpeakOutA, LOW);
    }
    if (ran == 2)
    {
      digitalWrite (SpeakOutB, HIGH);
      Alarm.delay (time4);
    }
    else
    {
      digitalWrite (SpeakOutB, LOW);
    }
    if (ran == 3)
    {
      digitalWrite (SpeakOutC, HIGH);
      Alarm.delay (time4);
    }
    else
    {
      digitalWrite (SpeakOutC, LOW);
    }
    if (ran == 4)
    {
      digitalWrite (SpeakOutD, HIGH);
      Alarm.delay (time4);
    }
    else
    {
      {
        digitalWrite (SpeakOutD, LOW);

      }
    }
    if (digitalRead(SwitchInputA) == HIGH && digitalRead(LightSensA) == LOW)
    {
      digitalWrite(PlayOutA, HIGH);    // sets the Play on
      digitalWrite(AmpOnOutA, HIGH);    // sets the AMP on
      digitalWrite(SoundOutA, HIGH);   // sets the sound 1 on
    }
    else
    {
      digitalWrite(PlayOutA, LOW);   // sets the Play off
      digitalWrite(AmpOnOutA, LOW);   // sets the AMP off
      digitalWrite(SoundOutA, LOW);   // sets the sound 1 off
    }
    if (digitalRead(SwitchInputB) == HIGH && digitalRead(LightSensA) == LOW)
    {
      digitalWrite(PlayOutA, HIGH);    // sets the Play on
      digitalWrite(AmpOnOutA, HIGH);    // sets the AMP on
      digitalWrite(SoundOutB, HIGH);   // sets the sound 1 on
    }
    else
    {
      digitalWrite(PlayOutA, LOW);   // sets the Play off
      digitalWrite(AmpOnOutA, LOW);   // sets the AMP off
      digitalWrite(SoundOutB, LOW);   // sets the sound 1 off
    }
    if (digitalRead(SwitchInputC) == HIGH && digitalRead(LightSensA) == LOW)
    {
      digitalWrite(PlayOutA, HIGH);    // sets the Play on
      digitalWrite(AmpOnOutA, HIGH);    // sets the AMP on
      digitalWrite(SoundOutC, HIGH);   // sets the sound 1 on
    }
    else
    {
      digitalWrite(PlayOutA, LOW);   // sets the Play off
      digitalWrite(AmpOnOutA, LOW);   // sets the AMP off
      digitalWrite(SoundOutC, LOW);   // sets the sound 1 off
    }
    if (digitalRead(SwitchInputD) == HIGH && digitalRead(LightSensA) == LOW)
    {
      digitalWrite(PlayOutA, HIGH);    // sets the Play on
      digitalWrite(AmpOnOutA, HIGH);    // sets the AMP on
      digitalWrite(SoundOutD, HIGH);   // sets the sound 1 on
    }
    else
    {
      digitalWrite(PlayOutA, LOW);   // sets the Play off
      digitalWrite(AmpOnOutA, LOW);   // sets the AMP off
      digitalWrite(SoundOutD, LOW);   // sets the sound 1 off
    }
    if (digitalRead(SwitchInputE) == HIGH && digitalRead(LightSensA) == LOW)
    {
      digitalWrite(PlayOutA, HIGH);    // sets the Play on
      digitalWrite(AmpOnOutA, HIGH);    // sets the AMP on
      digitalWrite(SoundOutE, HIGH);   // sets the sound 1 on
    }
    else
    {
      digitalWrite(PlayOutA, LOW);   // sets the Play off
      digitalWrite(AmpOnOutA, LOW);   // sets the AMP off
      digitalWrite(SoundOutE, LOW);   // sets the sound 1 off
    } 
    if (digitalRead(SwitchInputF) == HIGH && digitalRead(LightSensA) == LOW)
    {
      digitalWrite(PlayOutA, HIGH);    // sets the Play on
      digitalWrite(AmpOnOutA, HIGH);    // sets the AMP on
      digitalWrite(SoundOutF, HIGH);   // sets the sound 1 on
    }
    else
    {
      digitalWrite(PlayOutA, LOW);   // sets the Play off
      digitalWrite(AmpOnOutA, LOW);   // sets the AMP off
      digitalWrite(SoundOutF, LOW);   // sets the sound 1 off
    }
    if (digitalRead(SwitchInputG) == HIGH && digitalRead(LightSensA) == LOW)
    {
      digitalWrite(PlayOutA, HIGH);    // sets the Play on
      digitalWrite(AmpOnOutA, HIGH);    // sets the AMP on
      digitalWrite(SoundOutG, HIGH);   // sets the sound 1 on
    }
    else
    {
      digitalWrite(PlayOutA, LOW);   // sets the Play off
      digitalWrite(AmpOnOutA, LOW);   // sets the AMP off
      digitalWrite(SoundOutG, LOW);   // sets the sound 1 off
    }
    if (digitalRead(SwitchInputH) == HIGH && digitalRead(LightSensA) == LOW)
    {
      digitalWrite(PlayOutA, HIGH);    // sets the Play on
      digitalWrite(AmpOnOutA, HIGH);    // sets the AMP on
      digitalWrite(SoundOutH, HIGH);   // sets the sound 1 on
    }
    else
    {
      digitalWrite(PlayOutA, LOW);   // sets the Play off
      digitalWrite(AmpOnOutA, LOW);   // sets the AMP off
      digitalWrite(SoundOutH, LOW);   // sets the sound 1 off
    }
    //if(currentMillis - previousMillis > interval)

   // when sounds finish start random timer 3 to 30 minutes then on again till play complete then loop
    Serial.print(SpeakVar);
    Serial.print("--");
    //Serial.print(RandOff);
    Serial.print("-");
    //Serial.print(SpeakerConA);
    Serial.print("--");
    Serial.print("delay");
    Serial.print("--");
    Serial.print(currentMillis);
    Serial.print("--");
    Serial.print(ran);
    Serial.print("--");
    Serial.print("Startover");
    Serial.print("---");

    Alarm.timerOnce(random(10), randomTimer);  // trigger after random number of seconds

    // waits for a random time while OFF*/
  }}

can someone please scan this for me and tell me where there are problems

The compiler will spot any syntactical errors; the semantic ones are your job.

it compiles ok just is there a cleaner smarter way to do the same thing Thanks

Some arrays for the "SoundOut" "SpeakOut" variables would condense things.

finaly got this working myself. a big thanks to those that tried to help Terry