HELP! Pushbutton code

I wrote a code to activate MOSFETs in series. There is only one push-button, on every press of the button, the next FET has to be activated. Running code on an ATtiny45

What I want the code to do is, when the button is pressed once, irrespective of the button's ON state duration, only the respective FET must be activted.

The problem with my code is, if the button is pressed and held there for longer than a few milliseconds, the control activates the corresponding FET and moves on to the next one. If the button is held pressed long enough, the control runs through all MOSFETs on just one button press. How do I stop this from happening?

unsigned long rxTrigger;
int rxPreset;
int potVal;
int Buzz = 3;
int count;
int Sw;

void setup()
{

  // Rx signal input
  pinMode (0, OUTPUT); 
  pinMode (1, OUTPUT);
  pinMode (2, INPUT);
  pinMode (3, OUTPUT);
  pinMode (4, OUTPUT);

  analogWrite (Buzz, 1024);    // Initialization tone
  delay (10);
  analogWrite (Buzz, LOW);
  delay (20);
  analogWrite (Buzz, 1024);
  delay (10);
  analogWrite (Buzz, LOW);
  delay (20);
  analogWrite (Buzz, 1024);
  delay (10);
  analogWrite (Buzz, LOW);

}

void loop()
{
  rxTrigger = pulseIn (2, HIGH);                  // Read Rx signal input

  if (rxTrigger > 1300)       
  {
    Sw = HIGH;    
  }  
  else 
  {
    Sw = LOW;
  }
  if (Sw == HIGH)
  {
    count ++;  
  }
  if (count > 3)
  {
    count = 0;
  }
  if (count == 0)
  {
    analogWrite (Buzz, 1024);
    delay (200);
    analogWrite (Buzz, LOW);

    digitalWrite (0, LOW); // switch off all MOSFETs
    digitalWrite (1, LOW);
    digitalWrite (4, LOW);
    delay (150);
  }
  else if (count == 1)
  {
    analogWrite (Buzz, 1024);
    delay (200);
    analogWrite (Buzz, LOW);

    digitalWrite (0, HIGH);
    digitalWrite (1, LOW);
    digitalWrite (4, LOW);   
    delay (150); 
  }
  else if (count == 2)
  {
    analogWrite (Buzz, 1024);
    delay (200);
    analogWrite (Buzz, LOW);

    digitalWrite (1, HIGH);
    digitalWrite (4, LOW);
    digitalWrite (0, LOW);
    delay (150);
  }
  else if (count == 3)
  {
    analogWrite (Buzz, 1024);
    delay (200);
    analogWrite (Buzz, LOW);

    digitalWrite (4, HIGH);
    digitalWrite (1, LOW);
    digitalWrite (0, LOW);
    delay(150);    
  }
}

Hi

For starters you have no debouncing code. As you press your button its actually turning on and off really fast a few times. There are many of ways to combat this. You can also deal with only iterating once no matter how long you hold the button for in your debouncing code as well.

http://arduino.cc/en/Tutorial/Debounce

Debouncing is only one of the problems you will have. You want to do something when the switch BECOMES pressed, not IS pressed. Look at the state change detection example.

Looking at the code it seems that he is sensing the button press from a radio receiver. So debouncing might not be an issue..