'variable' or 'field' declared void

Hello there this is a code for electronic 3 X 3 dice in which there is a problem in void function the code is as follows

int a;
int b;
int c;
int d;
int e;
int f;
void setup() {
  Serial.begin(9600);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
}
void loop() {
  int i;
  i = random(0, 7);
  if (i == 1) {
    led(8, 3, 3, 3, 3, 3, 5);
    led(3, 3, 3, 3, 3, 3, 5);  // led delay 500 500
  }
  if (i == 2) {
    led(6, 10, 3, 3, 3, 3, 5);
    led(4, 12, 3, 3, 3, 3, 5)
  }
  if (i == 3) {  // Testing needed
    led(4, 3, 3, 3, 3, 3, 2.5);
    led(4, 5, 3, 3, 3, 3, 2.5);
    led(4, 5, 6, 3, 3, 3, 5);
    led(4, 5, 3, 3, 3, 3, 2.5);
    led(4, 3, 3, 3, 3, 3, 2.5);
    led(3, 3, 3, 3, 3, 3, 2.5);
  }
  if (i == 4) {
    led(4, 6, 10, 12, 3, 3, 5);
  }
  if (i == 5) {
    led(4, 6, 8, 10, 12, 3, 5);
  }
  if (i == 6) {
  }
}
void led(a, b, c, d, e, f, int i) {
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, HIGH);
  delay(i * 100);
}

This is wrong

void led(a, b, c, d, e, f, int i)

Because a..f are global variables, you can leave them out (void led(int i) and the function calls to led become led(n) where 'n' is a number.

Alternatively you must specify the type of a..f in void led(a, b, c, d, e, f, int i).

You need to define the type of each argument when define a function

Also, if the last argument of function declared as int, it is pointless to pass float to it:

sterretje thanks

b707 thanks for answering and pointing out mistake of float
Appreciated that you went through whole code

Apart from what they have already told you about global variables and parameters, let me point out just a detail: remember that "void" is a data type and should not be used as a synonym for "function".
A function declared as "void something()" just means it doesn't return any value (that's the meaning of "void").
If in your message you need to reference us a function you should use its name: "there is a problem in led() function".

Try to fix first the errors, pointed in post 2

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.