Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (buttonState == LOW) {//Call Game function
- tone(BUZZER,pitch);
- delay(500);
- noTone(BUZZER);
- delay(2000); //Up to this point it works fine
- for ( int i = 1 ; i <= NumOfTries ; ++i) //This worked fine untill I added the if + for statement below
- {
- delay(random(2000,4000));
- time1 = millis();//take time
- digitalWrite(LED1,HIGH);//make the LED switch on
- if (buttonState == LOW){//When button is pressed
- digitalWrite(LED1,LOW);//turn LED off
- time2 = millis();//Take the time
- for (int p = 0 ; p <= NumOfTries ; ++p){
- time2 - time1 == myResult[p];//Find the difference in the time and put it in an array
- Serial.println(myResult[p]);//Print the array with results
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement