NEWBIE programming questions

***modified this post to allow the people that already viewed to see full code. any help would be great.

I am new to Arduino and have been trying to build a light bar using the Arduino and have run into a problem with randomizing my functions.
I currently have
//*******
void setup()
{
}

//begin function flashers**//
void flashers(int t1,int t2)
{

pinMode(13,OUTPUT);
pinMode (12,OUTPUT);
pinMode(1,OUTPUT);
pinMode(4,OUTPUT);

digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(1,LOW);
digitalWrite(4,LOW);
delay(200);

digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(1,HIGH);
digitalWrite(4,HIGH);
delay(200);
}
//*********************END FUNCTION flashers

//****************begin function scatter//

void scatter()
{
pinMode(13,OUTPUT);
pinMode (12,OUTPUT);
pinMode(1,OUTPUT);
pinMode(4,OUTPUT);

digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(1,HIGH);
digitalWrite(4,LOW);
delay(100);

digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(1,LOW);
digitalWrite(4,HIGH);
delay(100);

digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(1,HIGH);
digitalWrite(4,LOW);
delay(100);

digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(1,LOW);
digitalWrite(4,HIGH);
delay(100);digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(1,HIGH);
digitalWrite(4,LOW);
delay(100);

digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(1,LOW);
digitalWrite(4,HIGH);
delay(100);
}
//*******************************END FUNCTION scatter***********88
//****begin function fade

int ledPin = 9; // LED connected to digital pin 9

void fade() {
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}

// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
//**********************end function fade
//***************************************begin function duals
void duals(int time1,int time2)
{

pinMode(13,OUTPUT);
pinMode (12,OUTPUT);
pinMode(1,OUTPUT);
pinMode(4,OUTPUT);

digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(1,LOW);
digitalWrite(4,HIGH);
delay(20);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(1,LOW);
digitalWrite(4,LOW);
delay(200);
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(1,LOW);
digitalWrite(4,HIGH);
delay(20);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(1,LOW);
digitalWrite(4,LOW);
delay(200);
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(1,HIGH);
digitalWrite(4,LOW);
delay(20);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(1,LOW);
digitalWrite(4,LOW);
delay(200);
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(1,HIGH);
digitalWrite(4,LOW);
delay(20);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(1,LOW);
digitalWrite(4,LOW);
delay(200);
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(1,LOW);
digitalWrite(4,HIGH);
delay(20);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(1,LOW);
digitalWrite(4,LOW);
delay(200);
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(1,LOW);
digitalWrite(4,HIGH);
delay(20);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(1,LOW);
digitalWrite(4,LOW);
delay(200);
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(1,HIGH);
digitalWrite(4,LOW);
delay(20);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(1,LOW);
digitalWrite(4,LOW);
delay(200);
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(1,HIGH);
digitalWrite(4,LOW);
delay(20);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(1,LOW);
digitalWrite(4,LOW);
delay(20);

}
//*********************end function duals
//********************Begin function random loops

void randoml()
{
(random(1,4));
if (random(1,4)==1){loop(scatter);}
if (random(1,4)==2){loop(duals(50,50));}
if (random(1,4)==3){loop(flashers(50,50));}
}
//********************end function random loops

void loop()

{
randoml();

}
I keep getting errors
sketch_jun16a.cpp: In function ‘void randoml()’:
sketch_jun16a:-1: error: too many arguments to function ‘void loop()’
sketch_jun16a:192: error: at this point in file
sketch_jun16a:193: error: invalid use of void expression
sketch_jun16a:194: error: invalid use of void expression
anyone able to help?

Looks like you have a 450+ line program that you haven’t developed incrementally. With just that little snippet of source, the problem could be anything.

I can see 3 problems so far:

x==(random(1,4));

You use "==" to compare things. So all this does is compare x to random (1,4) and then discard the result.

If guessing you have scatter1 declared like this (it would help if you showed it):

void scatter1 (int x)
{
// whatever
}

The this line:

 if (random(1,4)==1){loop(scatter1(50));}

gives this error:

sketch_jun16b:10: error: invalid use of void expression

Because you are using the results of a void function as an argument to a function.

And:

loop(scatter1(50));

The main Arduino function calls loop, you don't normally call it yourself.

ramdom vs random

Please use the [ code ] tags when posting code. Edit the post, select the code, and hit the "#" button.

Now, I don't understand the end. Here is the loop function:

void loop()

{
  randoml();

}

That is automatically called repeatedly, hence its name.

Now just above it you have:

void randoml()
{
  (random(1,4));
  if (random(1,4)==1){
    loop(scatter);
  }
  if (random(1,4)==2){
    loop(duals(50,50));
  }
  if (random(1,4)==3){
    loop(flashers(50,50));
  }
}

So loop calls randoml, and randoml calls loop. So this will become an infinite loop (not a good thing).

Besides, the loop function doesn't take arguments, which is why you get the error message.

What are you trying to do here?

  (random(1,4));

I've already mentioned these points earlier.

I think what you are trying to achieve is closer to this (which compiles OK):

void randoml()
{
  byte n = random (1,4);
  
  if (n==1)
    {
    scatter ();
    }

  if (n==2)
    {
    duals(50,50);
    }

  if (n==3)
    {
    flashers(50,50);
    }
}

That worked perfectly.I was trying to randomly call functions. I am using this for a light bar on my car and wanted to set this so that I had preset flashes to use when I wanted and have a random one that would select whatever it wanted. Thank you very much I have been working on how to randomize my functions for about a week. Greatly appreciate it.