Why an initial blink

Below is a sketch for an Arduino Deumilanove. When I load the program, the LED on pin 13 comes on for moment and then the sketch works fine. Why the flash and how do I get rid of it? Thanks

const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin
const int led2pin =4;
int buttonState = 0;     
void setup() {
    pinMode(ledPin, OUTPUT);
   pinMode(buttonPin, INPUT);
  pinMode (led2pin, OUTPUT);
  digitalWrite(ledPin, LOW);
}
void loop() {
   buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
    digitalWrite(led2pin,LOW);
      } else {    
    digitalWrite(led2pin,HIGH);
    digitalWrite(ledPin, LOW);
  }
}

Why the flash and how do I get rid of it?

This flashing is done by the boot loader when you upload a sketch to the board.

You can program the chip using ICSP (google Arduino ICSP) to stop power up flashing on 13.
However, you will loose the boot loader if you do this.
.

I tried it on 12 and the same thing happened but not on 4????

Assuming one side of your switch is connected to ground and the other side to the buttonPin

Make sure you have a pull-up resistor on buttonPin

OR use

pinMode(buttonPin, INPUT_PULLUP );

.

The Arduino boards start and 'flash' pins when first powered on.

check to see if you light and LED by driving the pin high, or bringing the pin low.