The same sketch runs different on Uno and Attiny

Hi!

I'm using Attiny45 with Arduino bootloader and everything is running ok. I tested this little sketch - on attiny it runs ok, the LED goes on as it should when I press button more than 1 sec. But on Arduino Uno the LED blinks from the start all the time and I cannot find the reason why is it so.
I hope you can help me. I'm using arduino IDE 0022 and uploading sketches to the Attiny with Uno as ISP. All other sketches run on Uno ok.

Here's my code:

const int ButtonPin = 0;
const int LedPin    = 1;

void setup() {
	pinMode(ButtonPin, INPUT);
	pinMode(LedPin, OUTPUT);
}

enum {WAIT, SETUP, READY, SHORT, LONG};
int State = WAIT;

void loop(){
	if (getButton(ButtonPin) == LONG)
	{
		digitalWrite(LedPin,HIGH);
		delay(1000);
		digitalWrite(LedPin,LOW);
		State = WAIT;
	}
	delay(200);	// pseudo debounce
}

int getButton(int pin) {
	int state = WAIT;
	unsigned long timer = millis();
	while (digitalRead(pin) == HIGH)
	{
		if (millis() - timer < 1000)
		{
			state = SHORT;
		}
		if (millis() - timer > 1000)
		{
			state = LONG;
			break;
		}
	}
	return state;
}

Pins 0 and 1 are used for Serial communication on the Arduino Uno; use different pins.

I tried this allready but it did not help.

rednaskellar:
I tried this allready but it did not help.

Your code doesn't reflect that. Nor did you post anything that shows how you've hooked up the momentary switch (what you call a button). How is your external pullup resistor hooked up?

It's connected like this: http://arduino.cc/en/uploads/Tutorial/button_schem.png, to pin 0

rednaskellar:
It's connected like this: http://arduino.cc/en/uploads/Tutorial/button_schem.png, to pin 0

I thought you said you didn't have it to connected to pin 0?

As I said I tried different pins but it didn't help.

rednaskellar:
As I said I tried different pins but it didn't help.

So you went back to a pin that is likely to give you issues even if you find another issue? When you say the LED blinks, is the blinking consistent, erratic? Is it turning on for 1 second and off for 200 mS as would be the case if ButtonPin was permanently HIGH?

Arrch:
Is it turning on for 1 second and off for 200 mS as would be the case if ButtonPin was permanently HIGH?

yes, exactly

ok - I changed once again pins, this time 13 for LED and 12 for switch and now it works... I have no idea why it did not earlier