Too many arguements to function?

Ardunio is telling me that a particular aspect of my code has too many arguements to function.

Now I’m a complete noob so bare with me. The aim of my program is to light up an increasing number of LED’s in order upon pressing a button. I’m trying to utilise an array here to achieve this.

The full error is 'too many arguments to function ‘void runSequence(long int)’

void runSequence(long duration){
 long t1 = millis() + duration;
 while (millis()<t1){
   digitalWrite(ledrun[1], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[1], LOW);
   delayMicroseconds(500);
   digitalWrite(ledrun[2], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[2], LOW);
   delayMicroseconds(500);
   digitalWrite(ledrun[3], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[3], LOW);
   delayMicroseconds(500);
   digitalWrite(ledrun[4], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[4], LOW);
   delayMicroseconds(500);
   digitalWrite(ledrun[5], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[5], LOW);
   delayMicroseconds(500);
   i++ ;
   
 }

Now, I thought my array was messing up in that particular section so naturally I tried to reduce that function just down to one LE.D. so something like this. Still no joy however and I can’t see the problem. I should mention it doesn’t even flag up this area of code it in fact flags up line 4 of my code (see full code below) about intledPin4 so bit confused there as well…

void runSequence(long duration){
 long t1 = millis() + duration;
 while (millis()<t1){
   digitalWrite(ledrun[1], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[1], LOW);
   delayMicroseconds(500);

Full Code below

int ledPin1=2;
int ledPin2=3;
int ledPin3=4;
int ledPin4=5;
int ledPin5=6;
int switchPin=7;
int val = 0;
int i;
int x = 0;
int j;
int cycles;
int ledrun[5] = {ledPin1, ledPin1 && ledPin2, ledPin1 && ledPin2 && ledPin3, 
ledPin1 && ledPin2 && ledPin3 && ledPin4, ledPin1 && ledPin2 && ledPin3 
&& ledPin4 && ledPin5};

void setup(){

 pinMode(ledPin1, OUTPUT);
 pinMode(ledPin2, OUTPUT);
 pinMode(ledPin3, OUTPUT);
 pinMode(ledPin4, OUTPUT);
 pinMode(ledPin5, OUTPUT);
 pinMode(switchPin, INPUT);

}

void loop(){
  val = digitalRead(switchPin);
  if (val == HIGH && x == 0){
   digitalWrite(ledPin1, LOW); 
   digitalWrite(ledPin2, LOW);
   digitalWrite(ledPin3, LOW);
   digitalWrite(ledPin4, LOW);
   digitalWrite(ledPin5, LOW);
   x ++ ;
  }
  
    else if (val == HIGH && x < 5){
  runSequence(ledrun[x], 500);
  x++;
  }
}


void runSequence(long duration){
 long t1 = millis() + duration;
 while (millis()<t1){
   digitalWrite(ledrun[1], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[1], LOW);
   delayMicroseconds(500);
   digitalWrite(ledrun[2], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[2], LOW);
   delayMicroseconds(500);
   digitalWrite(ledrun[3], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[3], LOW);
   delayMicroseconds(500);
   digitalWrite(ledrun[4], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[4], LOW);
   delayMicroseconds(500);
   digitalWrite(ledrun[5], HIGH);
   delayMicroseconds(500);
   digitalWrite(ledrun[5], LOW);
   delayMicroseconds(500);
   i++ ;
   
 }
  
   do 
   {runSequence;} while (i < 3);
}

You have called with 2 parameters when it only has 1.

Mark

Hi Mark,

Could you go into a bit more detail please of the specifics of the code?

Thanks, Dan

Here's the culprit:

  runSequence(ledrun[x], 500);

Two parameters in the call which therefore doesn't match the definition a few lines later:

void runSequence(long duration){

The error message contained the line number - that's a really big hint !

Mark

int ledrun[5] = {ledPin1, ledPin1 && ledPin2, ledPin1 && ledPin2 && ledPin3, 
ledPin1 && ledPin2 && ledPin3 && ledPin4, ledPin1 && ledPin2 && ledPin3 
&& ledPin4 && ledPin5};

What do you think this is doing? It isn't!