int numb123 = 0;
int button = 8;
int buttonState;
const int dummy = 1;
void setup() {
Serial.begin(9600);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(8, INPUT);
pinMode(9, OUTPUT);
}
void loop() {
while(dummy == 1) { // While loop that lasts forever seeing as dummy is a constant integer that is set to 1.
// Start of the function declaration.
void firstFunct() {
digitalWrite(9, HIGH);
delay(250);
digitalWrite(9, LOW);
delay(100);
digitalWrite(9, HIGH);
delay(500);
digitalWrite(9, LOW);
return 0;
}
// Finish of the function declaration.
buttonState = digitalRead(button);
if(buttonState == LOW) { // The light counting sequence only works if the button is not pressed, the button is intended
if(numb123 != 32000) {
numb123 = numb123++; // to be a reset.
Serial.println(numb123);
if(numb123 < 5000) { // As long as the number is less than 5000 the first light will be on.
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}else if((numb123 > 5000) && (numb123 < 15000)) { // As long as the number is greater than 5000 and less than 15000 the
digitalWrite(2, LOW); // second light will be on.
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}else if((numb123 > 15000) && (numb123 < 20000)) { // As long as the number is greater than 15000 and less than 20000 the
digitalWrite(2, LOW); // third light will be on.
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}else if((numb123 > 20000) && (numb123 < 25000)) { // As long as the number is greater than 20000 and less than 25000
digitalWrite(2, LOW); // the fourth light will be on.
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
}else if(numb123 > 25000) { // As long as the number is greater than 25000 the fifth light
digitalWrite(2, LOW); // will be on.
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
}
}else if (numb123 >= 32000) {
numb123 = 32000;
firstFunct();
}
} else if (buttonState == HIGH) { // Checks to see if the button has been pushed.
numb123 = 0;
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}
}
Please help me find the bug. It's making me like and for me, a beginner Arduino programmer, looking for the bug had me like
and I just want to be like
so any help that you have would be appreciated.