So I'm trying to make a dice with blue LED's where it cycles through numbers 1 to 6 until an LDR has a certain value a.k.a. your hand is removed from the LDR. When making this I use 4 sets of LED's connected to 4 pins(Screenshot by Lightshot).
For code I use
int value = 0;
int a = 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 was planning on expanding this but first wanted to see if I could get it to cycle through all the numbers. Now everytime I try to test it, it gives me this 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' was not declared in this scope
roll(LOW, LOW, LOW, HIGH); //1
^
C:\Users\Hidde\Documents\Arduino\Dice\Dice.ino: At global scope:
Dice:28: error: 'value' does not name a 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' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Any tips?