Need help with buttons?

Hey all, totaly new to arduino here and still learning what is all possible and what isnt. Writing programs for this board (UNO i think) has proven to be a challenge.

I am currently working on a project where I need my arduino to send on/off signals to another board (sound fx board from adafruit) and manipulate the pins on a dime. what i mean is that i need 2 switches to control 3 distinct sounds in a fashion i cant seem to figure out.

The sound kit im using isnt polyphonic, meaning it can not play one sound while another is playing. What I am looking to accomplish is pretty strange i think. First, button 1 has to be able to play Sound #1, then delay x amount of seconds and trigger Sound #3 when Button 1 is pressed the first time only (this button is a toggle switch that will remain HIGH that will be spliced into third electronics kit as its power switch). Then I need Button 2 to play Sound 2 when HIGH and go back to sound #3 when it returns to its low state. I would like to incorporate a sound 4 if button 2 is held high for too long (10 seconds or so) but it would still need to go back to sound 3 after that cycle.

am i on the right track with my code here or is there something else entirely different i need to be doing? thanks in advance!

const int button1 = 12;    
const int button2 =  13;   
const int button3 = 11;
const int sound1 = 9;
const int sound2 = 8;
const int sound3 = 7;

int buttonState = 0;

void setup() {
  pinMode(sound1, OUTPUT);      
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);  
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(button1);
  buttonState = digitalRead(button2);
  if (button1 == HIGH) {     
    // turn Sound 1 on:    
    digitalWrite(sound1, HIGH);
  }
else {
   digitalWrite(sound1, LOW);
  if (button2 == HIGH) {
    // turn Sound 2 on:
    digitalWrite (sound2, HIGH);
  }
  }
  else {
    // turns on HUM LOOP effect:
    digitalWrite(sound3, HIGH); 
  }
}

Have you tried the program? Does it do what you want? If not, what does it do/not do?

Weedpharma

so far the program runs as is but the sound board wont allow the next button press to send a signal in from the arduino pins unless i switch off the first switch.

you need different buttonState variables for each button ( button1State,button2State) and then actually use them.
eg. if (button1State == HIGH)

Then to get your delays you will need timing code for each delay period. see also: Several things at the same time

unsigned long startTime = 0;
const long interval = 1000;  // 1 second = 1000 millis
bool timeFlag = false;

void setup()
{
}

void loop()
{
  if (something you want to Time)
  {
    timeFlag = true;
    startTime = millis(); // Begins the timing sequence
    // do stuff here when timing sequence starts
  }

  unsigned long currentTime = millis();
  if (timeFlag == true && currentTime - startTime >= interval) // Ends the timing sequence
  {
    timeFlag = false;
    // do stuff here when time is up
  }
}