5/19/2023 0 Comments Simon says color game![]() Serial.println(redVal) //again some trouble shoot While (digitalRead(buttonPin1) = HIGH & digitalRead(buttonPin2) = HIGH) P.S this the part i think i have the issue Should have values in the variables to show you that*/ While (numShow >= 0)/* this while loop is suppose to read the values from the push buttonsĪnd if you were able to repeat the sequence correctly or you failed it Serial.println(redVal) //those are prints for trouble shooting Times and counting how much every LED blinked and how much times the loop looped basicly its for generating random sequences*/ While (show > numShow)/*this while loop is responsible for blinking the LEDs a spesific amount of ![]() RandomSeed(analogRead(0)) //the random number genaratorÄigitalWrite(buttonPin1, HIGH) //for the pull up resistors Long randNumber //a random number variabel Int numShow = 0 //the counter for the number of time the LEDs light up Int show = 1 //the number of time the LEDs light up Int lose = 0 //the buzzer activator not important righ now Int blueVal = 0, redVal = 0 //the LEDs counter Int buttonVal1, buttonVal2 //the pushbuttton value ![]() Int buttonPin1 = 9, buttonPin2 = 8 //the pushbutton pins Int ledPinB = 7, ledPinR = 6 //the power pins of the LEDs i can show the circit that i built in tinkercad this code is for simon says with two LEDs(I will add two more when i can do the first two) Here is the code so you can look at what I have done I tried my best explaining the code lines hope you can understand and find help me find the solution. The problem is that I can't find a way to use the pushbuttons to repeat the sequence that is shown with the LEDs like int a Simon Says game. So for starters I used only two LEDs and two pushbuttons just to get the concept and I am stock and I need help with the code. I started on what I thought was a fun and easy little project for my skill level in ARDUINO and it was to make a Simon says game with 4 LEDs 4 push buttons and a buzzer.
0 Comments
Leave a Reply. |