Sorry for the confusion and thank you everyone for your help!!
Here is what I have so far, I’ve just got it running the 6th loop for now while I tested my circuit, but you get the idea.
I eventually want these series of events to happen (again, sorry for misuse of terminology, Im trying!
)
-power on
-generate random number
-run loop that matches that number
- if button on pin 7 is pushed, loop 11 (solid red led) runs
- if button on pin 6 is pushed, loop 12 (solid green led) runs
So im basically stuck at making it use the serial it is printing as a way of picking a loop. I think I can work the button things out myself, but any help is welcome.
Again, just started in the last 24 hours so excuse the mess, I’m using this little puzzle as motivation to learn and get better. thank you for all your help!
//LED PARTERN CODE GAME//
/*put info about game here
*
*
*
*/
//Setup Area//
//Setup 1//
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT); //BLUE
pinMode(12, OUTPUT); //RED
pinMode(11, OUTPUT); //YELLOW
pinMode(10, OUTPUT); //GREEN
//Random Number Gen//
long randNumber;
Serial.begin(9600);
// if analog input pin 0 is unconnected, random analog
// noise will cause the call to randomSeed() to generate
// different seed numbers each time the sketch runs.
// randomSeed() will then shuffle the random function
randomSeed(analogRead(0));
// print a random number from 1 to 10
randNumber = random(5, 7);
Serial.println(randNumber);
delay(2000);
}
//loop Area//
void loop()
{
/*loopPart1();
loopPart2();
loopPart3();
loopPart4();
loopPart5(); */
loopPart6();
}
//multiple Loops Part//
// //
/*// Loop for Blue(13) Red(12) Yellow(11) Green(10)
void loopPart2() {
digitalWrite(13, HIGH); // turn the blue LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(12, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(11, HIGH); // turn the blue LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(11, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(10, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for a second
}
// Loop for Green(10) Yellow(11) Red(12) Blue(13)//
void loopPart3() {
digitalWrite(10, HIGH); // turn the blue LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(11, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(11, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(12, HIGH); // turn the blue LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(13, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for a second
}
//Loop for Red(12) Red(12) Blue(13) Red(12)//
void loopPart4() {
digitalWrite(12, HIGH); // turn the blue LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(12, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(13, HIGH); // turn the blue LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(12, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for a second
}
//Loop for Green(10) Green(10) Green(10) Green(10) Green(10) Green(10) Green(10) Blue(13) //
void loopPart5() {
digitalWrite(10, HIGH); // turn the blue LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(10, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(10, HIGH); // turn the blue LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(10, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(10, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(10, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(13, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for a second
}
*/
// Loop for x3 RED (12)//
void loopPart6() {
//
digitalWrite(12, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(12, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
//
digitalWrite(12, HIGH); // turn the red LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
// Area for solving the puzzle
[CODE]