Functions parameters(solved)

Hi
I have some problems with the function.. I want to shorten op the code but with my knowledge of arduino and C programming I can't find a solution. here is the code:

int pin9 = 9;
int pin5 = 5;

void setup(){
  pinMode(pin9, OUTPUT);
  pinMode(pin5, OUTPUT);
}

void loop()
{
  dot(pin9); dot(pin5);
  dot(pin9); dot(pin5); 
  dash(pin9); dash(pin5);
  dash(pin9); dash(pin5); 
}

void dot(int pin)
{
  if(pin==pin9){
    digitalWrite(pin9, HIGH);
    delay(250);
    digitalWrite(pin9, LOW);
    delay(250);
  }
  if(pin==pin5){
    digitalWrite(pin5, HIGH);
    delay(250);
    digitalWrite(pin5, LOW);
    delay(250);
  }
}

void dash(int pin)
{
  if(pin==pin9){
    digitalWrite(pin9, HIGH);
    delay(1000);
    digitalWrite(pin9, LOW);
    delay(250);
  }
  if(pin==pin5){
    digitalWrite(pin5, HIGH);
    delay(1000);
    digitalWrite(pin5, LOW);
    delay(250);
  }
}

The function dot and dash is what I want to shorten op (the code is just a cut out of the complete program)

I would like to be able to writhe dot(pin9); and then it uses the argument to choose the pin.. is that possible or do I need to change the syntax to do this? in that chase, what should I change it to?

/Mikkel

void dash(int pin)
{
    digitalWrite(pin, HIGH);
    delay(1000);
    digitalWrite(pin, LOW);
    delay(250);
}

The rest is left as an exercise for the reader.

thanks AWOL it works :smiley: