newbie needing help with buttons and loops

Hi, I have done a few button examples in some books and Im trying to do my own but I dont know how to make the state of a switch go back to low after its been pressed.

I want to have a 2 led 2 button setup that detects a sequence of 11, 12, 21 which will turn on a green led and 22 that will turn a red led on

The code is below and at serial.print(state1); the state of the button reads 1 without it being pressed.

void loop()
{
int state1 = digitalRead(switch1);
int state2 = digitalRead(switch2);

do
{
  if(state1 || state2 == HIGH)
  {
    next(state1, state2);
    
  }
}
while(state1 && state2 == LOW);

}

void next(int state1, int state2)
{
  if(state1 == HIGH)
  {
    digitalWrite(LED1, HIGH);
    int pin1 = 0;
    Serial.println(state1);
    delay(3000);
  }
  if(state2 == HIGH)
  {
    digitalWrite(LED1, HIGH);
    int pin1 = 1;
  }
}

I'm not 100% sure what you mean.... do you mean the hardware state of a push-button being forced low once it's been released?

If so, you need a pull-down resistor as explained here, about half-way down. (Don't do it with just a wire without a resistor, since that would just short-circuit the power supply to ground and release magic smoke.)

i hope this will help too:

how to make the state of a switch go back to low after its been pressed

+

delay(3000);

--->check out principle of http://arduino.cc/en/Tutorial/BlinkWithoutDelay

about input state and internal pullups and stuff check out this: http://arduino.cc/en/Tutorial/DigitalPins

http://www.ladyada.net/learn/arduino/lesson2.html

http://hacking.majenko.co.uk/the-while-loop