Error 'roll' was not declared in this scope.


so i'm trying make dice blue led's cycles through numbers 1 6 until ldr has value a.k.a. hand removed ldr. when making use 4 sets of led's connected 4 pins(http://prntscr.com/dr0hlx).
for code use
int value = 0;
int = 0;
int b = 0;
int c = 0;
int d = 0;
void setup() {
  pinmode(2, output);
  pinmode(3, output);
  pinmode(4, output);
  pinmode(5, output);
  pinmode(a0, input);
}

void loop() {
  if (value > 750) {
    roll(low, low, low, high);  //1
    roll(high, low, low, low);  //2
    roll(high, low, low, high); //3
    roll(high, low, high, low); //4
    roll(high, low, high, high);//5
    roll(high, high, high, low);//6
  }
  else {
    value = analogread(a0);
  }
}
void roll(int a, int b, int c, int d);
  value = analogread(a0);
  digitalwrite(2, a);
  digitalwrite(3, b);
  digitalwrite(4, c);
  digitalwrite(5, d);
  delay(50);
i planning on expanding first wanted see if cycle through numbers. everytime try test it, gives me error:
arduino: 1.6.13 (windows 10), board: "arduino/genuino uno"

c:\users\hidde\documents\arduino\dice\dice.ino: in function 'void loop()':

dice:16: error: 'roll' not declared in scope

     roll(low, low, low, high);  //1

                             ^

c:\users\hidde\documents\arduino\dice\dice.ino: @ global scope:

dice:28: error: 'value' not name type

   value = analogread(a0);

   ^

dice:29: error: expected constructor, destructor, or type conversion before '(' token

   digitalwrite(2, a);

               ^

dice:30: error: expected constructor, destructor, or type conversion before '(' token

   digitalwrite(3, b);

               ^

dice:31: error: expected constructor, destructor, or type conversion before '(' token

   digitalwrite(4, c);

               ^

dice:32: error: expected constructor, destructor, or type conversion before '(' token

   digitalwrite(5, d);

               ^

dice:33: error: expected constructor, destructor, or type conversion before '(' token

   delay(50);

        ^

exit status 1
'roll' not declared in scope

this report have more information with
"show verbose output during compilation"
option enabled in file -> preferences.
any tips?

hi - @ how setup , loop written, roll function has ; @ end , missing {}

code: [select]
int value = 0;
int = 0;
int b = 0;
int c = 0;
int d = 0;
void setup() {
  pinmode(2, output);
  pinmode(3, output);
  pinmode(4, output);
  pinmode(5, output);
  pinmode(a0, input);
}

void loop() {
  if (value > 750) {
    roll(low, low, low, high);  //1
    roll(high, low, low, low);  //2
    roll(high, low, low, high); //3
    roll(high, low, high, low); //4
    roll(high, low, high, high);//5
    roll(high, high, high, low);//6
  }
  else {
    value = analogread(a0);
  }
}
void roll(int a, int b, int c, int d)
{
  value = analogread(a0);
  digitalwrite(2, a);
  digitalwrite(3, b);
  digitalwrite(4, c);
  digitalwrite(5, d);
  delay(50);
}


Arduino Forum > Using Arduino > Programming Questions > Error 'roll' was not declared in this scope.


arduino

Comments

Popular posts from this blog

Help needed for choosing soldering station

Error Message when accessing Adobe

Adafruit Huzzah with Arduino Uno