help with adafruit fx soundboard

Using arduino nano clone and want to trigger pins on adafruit fx soundboard when button is pressed. The leds work fine with the code, but the digitalWrite commands to the the soundboard are not functioning. I cant see anything wrong with my code functionally. Please let me know if you do. i will get sound when the board is powered up, but that is it.

/* LED Eyes & Voice Button Control

*/

const int buttonPin = 8; // button pin const int ledPinLeft = 7; // left eye light const int ledPinRight = 6; // right eye light const int speakerPinOn = 5; // intro voice const int speakerPinOff = 4; // outro voice int buttonState = 0; int prevButtonState = 0; int on_off = 0;

void setup() { Serial.begin(9600); pinMode(buttonPin, INPUT_PULLUP); // on off button pinMode pinMode(ledPinLeft, OUTPUT); //LED Left Eye pinMode(ledPinRight, OUTPUT); // LED Right Eye pinMode(speakerPinOn, OUTPUT); // output to adafruit fx soundboard pin 0 pinMode(speakerPinOff, OUTPUT); // output to adafruit fx soundboard pin 1 }

void loop() { // button buttonState = digitalRead(buttonPin);

//if button pressed if ((buttonState == 0) && (prevButtonState == 1)) { on_off = 1-on_off; //switches state so led stays on or off depending on last state } prevButtonState = buttonState;

if (on_off == 1) { digitalWrite(ledPinLeft, HIGH); digitalWrite(ledPinRight, HIGH); digitalWrite(speakerPinOn, HIGH); Serial.print("on"); } else { digitalWrite(ledPinLeft, LOW); digitalWrite(ledPinRight, LOW); digitalWrite(speakerPinOff, HIGH); Serial.print("off"); }

}

Got the ground of the fx board connected to the ground of the nano?

That code will end up with both signals to the fx board being high, there is nothing to turn them low.

See the how to use this forum sticky post for information about how to post code correctly and how to ask a question.

Thanks Mike, I see your name quite a bit within this forum trying to help people with their issues. I appreciate that. I have used some of your advice to others in a few instances where I was stuck in the recent past. I am very new to all this electronics and coding etc. but I am having a blast. That is when i am not pulling my hair out anyway.

I went ahead and read through the sticky post as you instructed before I decided to reply. I am going to re-post the code below changing only the values that i am digitalWrite(ing) to the pins for the soundboard from HIGH to LOW. I am making this change because when i have them set to LOW i am able to get the sound board to function when i remove or insert the lead into my breadboard; at least for pin 5 anyway. I am going to try to post the code here according to the forum instructions.

To answer your question; Yes. Both boards are connected to the same ground. Is that not appropriate? I am trying to use the digital pins 4 & 5 of the nano to switch the signal from HIGH to LOW and trigger the soundboard pins i am connected to using the same button that i am using for the leds.

I wanted to clarify something from my last post. Upon startup (power-up or reloading of code) of the board(s), the audio is triggered, but that is the only time i can trigger it. The button in the code is triggering the leds on and off as i expect, but the fx board does not get triggered.

Every bit of help is greatly appreciated! Thanks again!

please see updated code below:

/*
LED Eyes & Voice Button Control

*/

const int buttonPin = 8; // button pin
const int ledPinLeft = 7; // left eye light
const int ledPinRight = 6; // right eye light
const int speakerPinOn = 5; // intro voice 
const int speakerPinOff = 4; // outro voice
int buttonState = 0;
int prevButtonState = 0;
int on_off = 0;


void setup() {
  Serial.begin(9600);
  pinMode(buttonPin, INPUT_PULLUP);   // on off button pinMode
  pinMode(ledPinLeft, OUTPUT);  //LED Left Eye
  pinMode(ledPinRight, OUTPUT); // LED Right Eye
  pinMode(speakerPinOn, OUTPUT); // output to adafruit fx soundboard pin 0
  pinMode(speakerPinOff, OUTPUT); // output to adafruit fx soundboard pin 1
}

void loop() {
// button
  buttonState = digitalRead(buttonPin);

  //if button pressed
         if ((buttonState == 0) && (prevButtonState == 1))
       {
       on_off = 1-on_off; //switches state so led stays on or off depending on last state
       }       
       prevButtonState = buttonState;
       
       if (on_off == 1)
       {
       digitalWrite(ledPinLeft, HIGH);
       digitalWrite(ledPinRight, HIGH);
       digitalWrite(speakerPinOn, LOW);
       Serial.print("on");
       }
       else
       {
         digitalWrite(ledPinLeft, LOW);
         digitalWrite(ledPinRight, LOW);
         digitalWrite(speakerPinOff, LOW);
         Serial.print("off");
       }
  
}

Please always do an Auto Format (Tools > Auto Format in the Arduino IDE or Ctrl + B in the Arduino Web Editor) on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read.

kcaska: changing only the values that i am digitalWrite(ing) to the pins for the soundboard from HIGH to LOW.

That doesn't change the issue that Grumpy_Mike pointed out (other than inverting the pin states):

Grumpy_Mike: That code will end up with both signals to the fx board being high, there is nothing to turn them low.

Once speakerPinOn and speakerPinOff are set LOW, there is no code that will ever set them HIGH again. The reason your LEDs are working is because your code sets each of those pins alternately HIGH and LOW.

When ever you set the speakerPinOff to one state you need to set the speakerPinOn pin to the other state. Same goes for the speakerPinOn.

Gotcha. Will give it a try. Thanks!

All,

Thanks for the help! Your recommendations worked and now I understand better why. I couldn't see it before. Also, thanks for the advice on how to use the forum better!

Wish you all the best! Happy New Year!

Okay, I am on the last part of the code for this project, but I am stuck again on triggering the sound board. (By the way, thanks again for the help with the initial code from this post.) Please review my code below and see if you can tell where I got it wrong. I am trying to trigger sound periodically by writing pin 2 on my arduino LOW which is connected to pin 2 on my adafruit fx sound board. The sound board has wav sound files in it that are set up to play randomly when pin 2 is triggered. The code as is right now plays no sound when the time periods occur. My trouble is with the last if statement in the code. That is the last 10 lines or so. I can’t seem to get it to function. Any help or suggestions would be greatly appreciated.

/*
  LED Eyes & Voice Button Control
  Millis() timed servo & voice control
*/


// servo latest version
#include <Servo.h>

Servo servo1;
int servoPos = 90;
const unsigned long eventInterval_1 = 30000;
const unsigned long eventInterval_2 = 50500;
const unsigned long eventInterval_3 = 72500;
unsigned long prevTime_1 = 0;
unsigned long prevTime_2 = 0;
unsigned long prevTime_3 = 0;

const int buttonPin = 8; // button pin
const int ledPinLeft = 7; // left eye light
const int ledPinRight = 6; // right eye light
const int speakerPinOn = 5; // intro voice
const int speakerPinOff = 4; // outro voice
const int speakerRand = 2; // random voice
int buttonState = 0;
int prevButtonState = 0;
int on_off = 0;


void setup() {
  Serial.begin(9600);
  pinMode(buttonPin, INPUT_PULLUP);   // on off button pinMode
  pinMode(ledPinLeft, OUTPUT);  //LED Left Eye
  pinMode(ledPinRight, OUTPUT); // LED Right Eye
  pinMode(speakerPinOn, OUTPUT); // output to adafruit fx soundboard pin 0
  pinMode(speakerPinOff, OUTPUT); // output to adafruit fx soundboard pin 1
  pinMode(speakerRand, OUTPUT); // output to fx pin 2

  servo1.attach(3);
  servo1.write(90);
}

void loop() {
  // button
  buttonState = digitalRead(buttonPin);

  //if button pressed
  if ((buttonState == 0) && (prevButtonState == 1))
  {
    on_off = 1 - on_off; //switches state so led stays on or off depending on last state
  }
  prevButtonState = buttonState;

  if (on_off == 1)
  {
    digitalWrite(ledPinLeft, HIGH);
    digitalWrite(ledPinRight, HIGH);
    digitalWrite(speakerPinOn, LOW);
    delay(150);
    digitalWrite(speakerPinOff, HIGH);
    digitalWrite(speakerRand, HIGH);
    Serial.print("on");
  }
  else
  {
    digitalWrite(ledPinLeft, LOW);
    digitalWrite(ledPinRight, LOW);
    digitalWrite(speakerPinOff, LOW);
    digitalWrite(speakerPinOn, HIGH);
    digitalWrite(speakerRand, HIGH);
    Serial.print("off");
  }
  if (speakerPinOn == LOW)
  {
    digitalWrite(speakerPinOn, HIGH);
  }
  // servo
  unsigned long currentTime = millis();
  if ((currentTime - prevTime_1 >= eventInterval_1) && (on_off == 1))
  {
    for (servoPos = 90; servoPos < 120; servoPos ++)
    {
      servo1.write(servoPos);
      delay(100);
    }
    for (servoPos = 120; servoPos > 90; servoPos --)
    {

      servo1.write(servoPos);
      delay(100);
    }
    prevTime_1 = currentTime;
  }
  if ((currentTime - prevTime_2 >= eventInterval_2) && (on_off == 1))
  {
    for (servoPos = 90; servoPos > 75; servoPos --)
    {
      servo1.write(servoPos);
      delay(100);
    }
    for (servoPos = 75; servoPos < 90; servoPos ++)
    {

      servo1.write(servoPos);
      delay(100);
    }
    prevTime_2 = currentTime;
  }

  if ((currentTime - prevTime_3 >= eventInterval_3) && (on_off == 1))
  {
    digitalWrite(speakerRand, LOW);
    delay(150);
    digitalWrite(speakerPinOn, HIGH);
    digitalWrite(speakerPinOff, HIGH);
    Serial.print("sound");
  }

  prevTime_3 = currentTime;
}

The line

prevTime_3 = currentTime;

Is performed every time round the loop so that last if clause will never trigger. Move it inside the code when it does trigger.

As a piece of general advice that loop function is too long, it is hard to follow. For more readable code always split distinct actions into their own function. Then it is easer to follow and debug. Their is no need to use the millis timer in moving the servo, a simple delay will do because using it like you did is blocking code anyway.

Mike, Thanks again for your support and suggestions. I tried just moving the line of code you specified in the last post to within the function, but I did not get a different result. I still could not trigger the 2nd pin on my fx board. I just finished rewriting the code into separate functions. Although I have not gotten a chance to test it out yet, I am posting it below to see if I did what you were suggesting in general. I will try it out this evening. Please let me know if this is what you meant by “splitting distinct actions into their own functions”. I am using millis() in the servo function to trigger the servo repeatedly as two separate timed event intervals. I did delete the delay line I had in there though, because I did notice that the servo operation was blocking the rest of the code, so the delay() operation I had was unnecessary.
Thanks again, please let me know if you see anything I am missing in this code:

/*
  LED Eyes & Voice Button Control
  Millis() timed servo & voice control
*/


// servo latest version
#include <Servo.h>

Servo servo1;
int servoPos = 90;
const unsigned long eventInterval_1 = 30000; // servo turn one way
const unsigned long eventInterval_2 = 50500; // servo turn other way
const unsigned long eventInterval_3 = 72500; // play random track from fx board
unsigned long prevTime_1 = 0; // use to calculate time since last event 1 took place
unsigned long prevTime_2 = 0; // use to calculate time since last event 2 took place
unsigned long prevTime_3 = 0; // use to calculate time since last event 3 took place

const int buttonPin = 8; // button pin
const int ledPinLeft = 7; // left eye light
const int ledPinRight = 6; // right eye light
const int speakerPinOn = 5; // intro voice
const int speakerPinOff = 4; // outro voice
const int speakerRand = 2; // random voice
int buttonState = 0; // set up initial button state to off
int prevButtonState = 0; // track button state so that switching on when off or vice versa is possible
int on_off = 0; // tracks current button state, whether on or off for use in other functions



void setup()
{
  Serial.begin(9600);
  pinMode(buttonPin, INPUT_PULLUP); // on off button pinMode
  pinMode(ledPinLeft, OUTPUT);  //LED Left Eye
  pinMode(ledPinRight, OUTPUT); // LED Right Eye
  pinMode(speakerPinOn, OUTPUT); // output to adafruit fx soundboard pin 0
  pinMode(speakerPinOff, OUTPUT); // output to adafruit fx soundboard pin 1
  pinMode(speakerRand, OUTPUT); // output to fx pin 2

  servo1.attach(3); // servo pin
  servo1.write(90); // initial servo position
}
void loop()
{
  button(); // start with button function
}
void button()  // button - turn LEDs on and activate servo and sound programming or turn everything off
{
  buttonState = digitalRead(buttonPin);

  //if button pressed
  if ((buttonState == 0) && (prevButtonState == 1))
  {
    on_off = 1 - on_off; //switches state so led stays on or off depending on last state
  }
  prevButtonState = buttonState;

  if (on_off == 1) // if leds were off and now are on
  {
    digitalWrite(ledPinLeft, HIGH); // turn on leds
    digitalWrite(ledPinRight, HIGH); //
    digitalWrite(speakerPinOn, LOW); // intro voice sounds when turned on
    delay(150);
    digitalWrite(speakerPinOff, HIGH);
    digitalWrite(speakerRand, HIGH);
    Serial.print("on");
    servo(); // since "on" activate servo activity timed events

    if (speakerPinOn == LOW)
    {
      digitalWrite(speakerPinOn, HIGH); // switch state back HIGH after trigger to reset
    }
  }
  else // if leds were on and now are off
  {
    digitalWrite(ledPinLeft, LOW); // turn off leds
    digitalWrite(ledPinRight, LOW); //
    digitalWrite(speakerPinOff, LOW); // outro voice sounds when turned off
    digitalWrite(speakerPinOn, HIGH);
    digitalWrite(speakerRand, HIGH);
    Serial.print("off");
  }
}
void servo()  // servo - neck movement
{
  unsigned long currentTime = millis(); // set up "current time" integerfor use in timed events
  if ((currentTime - prevTime_1 >= eventInterval_1) && (on_off == 1)) // sweep left
  {
    for (servoPos = 90; servoPos < 120; servoPos ++)
    {
      servo1.write(servoPos);
    }
    for (servoPos = 120; servoPos > 90; servoPos --)
    {
      servo1.write(servoPos);
    }
    prevTime_1 = currentTime;
  }
  if ((currentTime - prevTime_2 >= eventInterval_2) && (on_off == 1)) // sweep right
  {
    for (servoPos = 90; servoPos > 75; servoPos --)
    {
      servo1.write(servoPos);
    }
    for (servoPos = 75; servoPos < 90; servoPos ++)
    {
      servo1.write(servoPos);
    }
    prevTime_2 = currentTime;
  }
  rand_Voice();
}
void rand_Voice() // random voice sound every so often while "on"
{
  unsigned long currentTime = millis();
  if ((currentTime - prevTime_3 > eventInterval_3) && (on_off == 1))
  {
    digitalWrite(speakerRand, LOW);
    delay(150);
    // digitalWrite(speakerPinOn, HIGH);
    // digitalWrite(speakerPinOff, HIGH);
    Serial.print("sound");
    prevTime_3 = currentTime;
  }
  digitalWrite(speakerRand, HIGH); // reset speakerRand pin
  button();
}

Okay, I tried the code from my post yesterday and it was a complete failure. Lots of bugs to find in it. I will need some more practice and experience before i can start writing code like that. So i am back to the original long loop because i only need to debug the last function for playing the random sound. I have tried several different strategies, some of which are evident in this updated code i am posting. Nothing has worked. Strangely, every so often the code will trigger the random pin, but it also triggers the on pin simultaneously. I can’t see the reason for it to behave this way, and i can’t make rhyme or reason why it only does it every now and again and not every time it is supposed to trigger based on the code loop (event_3 interval). If anyone has any ideas please help!

Thanks!

/*
  LED Eyes & Voice Button Control
  Millis() timed servo & voice control
*/


// servo latest version
#include <Servo.h>

Servo servo1;
int servoPos = 90;
const unsigned long eventInterval_1 = 30000;
const unsigned long eventInterval_2 = 50500;
const unsigned long eventInterval_3 = 89250;
unsigned long prevTime_1 = 0;
unsigned long prevTime_2 = 0;
unsigned long prevTime_3 = 0;

const int buttonPin = 8; // button pin
const int ledPinLeft = 7; // left eye light
const int ledPinRight = 6; // right eye light
const int speakerPinOn = 5; // intro voice
const int speakerPinOff = 4; // outro voice
const int speakerRand = 12; // random voice
int buttonState = 0;
int prevButtonState = 0;
int on_off = 0;


void setup() {
  Serial.begin(9600);
  pinMode(buttonPin, INPUT_PULLUP);   // on off button pinMode
  pinMode(ledPinLeft, OUTPUT);  //LED Left Eye
  pinMode(ledPinRight, OUTPUT); // LED Right Eye
  pinMode(speakerPinOn, OUTPUT); // output to adafruit fx soundboard pin 0
  pinMode(speakerPinOff, OUTPUT); // output to adafruit fx soundboard pin 1
  pinMode(speakerRand, OUTPUT); // output to fx pin 2

  servo1.attach(3);
  servo1.write(90);
}

void loop() {
  digitalWrite(speakerPinOn, LOW);
  digitalWrite(speakerPinOff, LOW);
  digitalWrite(speakerRand, LOW);

  // button
  buttonState = digitalRead(buttonPin);

  //if button pressed
  if ((buttonState == 0) && (prevButtonState == 1))
  {
    on_off = 1 - on_off; //switches state so led stays on or off depending on last state
  }
  prevButtonState = buttonState;

  if (on_off == 1)
  {
    digitalWrite(ledPinLeft, HIGH);
    digitalWrite(ledPinRight, HIGH);
    digitalWrite(speakerPinOn, LOW);
    delay(150);
    digitalWrite(speakerPinOff, HIGH);
    digitalWrite(speakerRand, HIGH);
    Serial.print("on");
  }
  else
  {
    digitalWrite(ledPinLeft, LOW);
    digitalWrite(ledPinRight, LOW);
    digitalWrite(speakerPinOff, LOW);
    digitalWrite(speakerPinOn, HIGH);
    digitalWrite(speakerRand, HIGH);
    Serial.print("off");
  }
  /*	if ((speakerPinOn == LOW) && (on_off == 1))
  	{
  	  digitalWrite(speakerPinOn, HIGH);
  	}
  	if((speakerPinOff == LOW) && (on_off == 0))
  	{
  	  digitalWrite(speakerPinOff, HIGH);
  	}*/
  // servo
  unsigned long currentTime = millis();
  if ((currentTime - prevTime_1 >= eventInterval_1) && (on_off == 1))
  {
    for (servoPos = 90; servoPos < 120; servoPos ++)
    {
      servo1.write(servoPos);
      delay(100);
    }
    for (servoPos = 120; servoPos > 90; servoPos --)
    {

      servo1.write(servoPos);
      delay(100);
    }
    prevTime_1 = currentTime;
  }
  if ((currentTime - prevTime_2 >= eventInterval_2) && (on_off == 1))
  {
    for (servoPos = 90; servoPos > 75; servoPos --)
    {
      servo1.write(servoPos);
      delay(100);
    }
    for (servoPos = 75; servoPos < 90; servoPos ++)
    {

      servo1.write(servoPos);
      delay(100);
    }
    prevTime_2 = currentTime;
  }

  if ((currentTime - prevTime_3 >= eventInterval_3) && (on_off == 1))
  {
    servo1.write(servoPos);

    digitalWrite(speakerRand, LOW);
    delay(500);
    digitalWrite(speakerPinOn, HIGH);
    digitalWrite(speakerPinOff, HIGH);
    Serial.print("------sound------");

    prevTime_3 = currentTime;
  }
  if ((speakerRand == LOW) && (on_off == 1))
  {
    digitalWrite(speakerRand, HIGH);
  }

}

Maybe it is not holding the signal long enough to trigger on most occasions? When i use the code snippet below it will trigger every so often (between the tenth and twentieth time that it should trigger). When i check with my meter, the arduino is sending the signals to the FX board when it should, and the board is receiving them, it just isn't triggering every time. Also, i am stumped because when it actually does trigger the pin that i want it to, it also triggers pin zero directly after. When i alter the code below to try to get it to trigger the pin i want without the other triggering, i can't get anything to trigger. So how can i alter the code below to get the signal to remain for longer than a fraction of a second? The data sheet for the board says that the signal should be held to ground for longer than 125 milliseconds. The delays() i've been trying to use in my code below don't seem to have any effect on how long the signal is held for. They just seem to delay the actual program from progressing. I didn't want to post the whole code again, so please reference a previous post if you need more context. Really i am just trying to debug this portion of the code right now. I haven't changed any of the other code and it all seems to be working now as i expect it to. Thanks in advance to anyone willing to take the time to help me out!

  if ((currentTime - prevTime_3 > eventInterval_3) && (on_off == 1))
  {
    //servo1.write(servoPos);
    delay(500);
    digitalWrite(speakerRand, LOW);
    delay(500);
    digitalWrite(speakerPinOn, HIGH);
    digitalWrite(speakerPinOff, HIGH);
    Serial.print("------sound------");

    prevTime_3 = currentTime;
  }

Finally got this code working. Turns out that the main problem was that I need to hold the code signal down for longer than it would with my original code. I accomplished this by adding a couple lines of code to delay() when sending the signal to the trigger pin. I also was struggling with noob syndrome. I have a lot to learn, but I am proud of my first completed successful sketch. Thanks once more to those that offered guidance. The working sketch is below.

/*
  LED Eyes & Voice Button Control
  Millis() timed servo & voice control
*/


// servo latest version
#include <Servo.h>

Servo servo1;
int servoPos = 90;
const unsigned long eventInterval_1 = 30000;
const unsigned long eventInterval_2 = 50500;
const unsigned long eventInterval_3 = 75000;
unsigned long prevTime_1 = 0;
unsigned long prevTime_2 = 0;
unsigned long prevTime_3 = 0;

const int buttonPin = 8; // button pin
const int ledPinLeft = 7; // left eye light
const int ledPinRight = 6; // right eye light
const int speakerPinOn = 2; // intro voice
const int speakerPinOff = 4; // outro voice
const int speakerRand = 5; // random voice
int buttonState = 0;
int prevButtonState = 0;
int on_off = 0;

int startUp = 0; // used to differentiate between start up, close down and random sound effects

void setup()
{
  Serial.begin(9600);
  pinMode(buttonPin, INPUT_PULLUP);   // on off button pinMode
  pinMode(ledPinLeft, OUTPUT);  //LED Left Eye
  pinMode(ledPinRight, OUTPUT); // LED Right Eye
  pinMode(speakerPinOn, OUTPUT); // output to adafruit fx soundboard pin 0
  pinMode(speakerPinOff, OUTPUT); // output to adafruit fx soundboard pin 1
  pinMode(speakerRand, OUTPUT); // output to fx pin 2

  servo1.attach(3);
  servo1.write(90);
}

void loop()
{
  // button
  buttonState = digitalRead(buttonPin);

  if ((buttonState == 0) && (prevButtonState == 1))
  {
    on_off = 1 - on_off; //switches state so led stays on or off depending on last state
  }
  prevButtonState = buttonState;

  if ((on_off == 1) && (startUp == 0)) // turned on
  {
    digitalWrite(ledPinLeft, HIGH);
    digitalWrite(ledPinRight, HIGH);
    digitalWrite(speakerPinOn, LOW);
    delay(150);
    digitalWrite(speakerPinOff, HIGH);
    digitalWrite(speakerRand, HIGH);
    //Serial.print("on");
    startUp = 1;
  }
  else if ((on_off == 0) && (startUp == 1)) // turned off
  {
    digitalWrite(ledPinLeft, LOW);
    digitalWrite(ledPinRight, LOW);
    digitalWrite(speakerPinOff, LOW);
    digitalWrite(speakerPinOn, HIGH);
    digitalWrite(speakerRand, HIGH);
    //Serial.print("off");
    startUp = 0;
  }
  else // skip turned on or off code while on
  {
    ; //do nothing
  }

  // servo
  unsigned long currentTime = millis();
  
  if ((currentTime - prevTime_1 >= eventInterval_1) && (on_off == 1)) //sweep look left and back center
  {
    for (servoPos = 90; servoPos < 120; servoPos ++)
    {
    servo1.write(servoPos);
    }
    for (servoPos = 120; servoPos > 90; servoPos --)
    {
    servo1.write(servoPos);
    }
    prevTime_1 = currentTime; // reset event interval
  }
  if ((currentTime - prevTime_2 >= eventInterval_2) && (on_off == 1)) // sweep look right and back center
  {
    for (servoPos = 90; servoPos > 75; servoPos --)
    {
    servo1.write(servoPos);
    }
    for (servoPos = 75; servoPos < 90; servoPos ++)
    {
    servo1.write(servoPos);
    }
    prevTime_2 = currentTime; // reset event 2 interval
  }

  if ((currentTime - prevTime_3 > eventInterval_3) && (on_off == 1)) // play random audio while on at specified event interval 3
  {
    digitalWrite(speakerRand, LOW);
    digitalWrite(speakerPinOn, HIGH);
    digitalWrite(speakerPinOff, HIGH);
    //Serial.print("------sound------");

    prevTime_3 = currentTime; // reset event 3 interval
  }
  
  if (digitalRead(speakerRand) == LOW) // delay to keep pin low until sound board triggers
  {
    delay(500);
  }
  
  if ((digitalRead(speakerRand) == LOW) && (on_off == 1)) // reset event 3 trigger pin
  {
    digitalWrite(speakerRand, HIGH);
  }
}

I have a lot to learn, but I am proud of my first completed successful sketch.

Well done, its great when something works, can't beat that feeling. This video expresses it:- http://www.youtube.com/watch?v=9saYHg_JmWE