Skip to main content

Firstly, I know that I have already posted this. I do not think anyone here is stupid so: The game is: a power source connected to 6 buttons connected to 6 LEDs. you press them all in the randomly generated order, and they blink in the order pressed after completion, then randomize and reset.

I have an array shuffler code 1)Does the array shuffler work 2)How do I configure ports and attach them to values in the array, 3) How do I use an if-then statement to say if all buttons pressed in order, then LEDs blink 3 times? I have a picture but not the actual Arduino, so, upon request, I can post the picture. Thank you. code:

void setup() {
    // put your setup code here, to run once:
} 

void loop() {
    // put your main code here, to run repeatedly:
    int questionNumberArray[] = {0,1,2,3,4,5,6};//the array itself
    const size_t n = sizeof(questionNumberArray) / //the array used
    sizeof(questionNumberArray[0]);//the base of the array

    for (size_t i = 0; i < n - 1; i++) //the loop itself
    {
        size_t j = random(1, n - i);
        int t = questionNumberArray[i]; //integer output for increase
        questionNumberArray[i] = questionNumberArray[j];//the value definition
        questionNumberArray[j] = t;
    }

}

The six buttons are connected to digital pins (1, 2, 9, 11, 12, 13)

Firstly, I know that I have already posted this. I do not think anyone here is stupid so: The game is: a power source connected to 6 buttons connected to 6 LEDs. you press them all in the randomly generated order, and they blink in the order pressed after completion, then randomize and reset.

I have an array shuffler code 1)Does the array shuffler work 2)How do I configure ports and attach them to values in the array, 3) How do I use an if-then statement to say if all buttons pressed in order, then LEDs blink 3 times? I have a picture but not the actual Arduino, so, upon request, I can post the picture. Thank you. code:

void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
int questionNumberArray[] = {0,1,2,3,4,5,6};//the array itself
const size_t n = sizeof(questionNumberArray) / //the array used
sizeof(questionNumberArray[0]);//the base of the array

for (size_t i = 0; i < n - 1; i++) //the loop itself
{
size_t j = random(1, n - i);
int t = questionNumberArray[i]; //integer output for increase
questionNumberArray[i] = questionNumberArray[j];//the value definition
questionNumberArray[j] = t;
}

}

Firstly, I know that I have already posted this. I do not think anyone here is stupid so: The game is: a power source connected to 6 buttons connected to 6 LEDs. you press them all in the randomly generated order, and they blink in the order pressed after completion, then randomize and reset.

I have an array shuffler code 1)Does the array shuffler work 2)How do I configure ports and attach them to values in the array, 3) How do I use an if-then statement to say if all buttons pressed in order, then LEDs blink 3 times? I have a picture but not the actual Arduino, so, upon request, I can post the picture. Thank you. code:

void setup() {
    // put your setup code here, to run once:
} 

void loop() {
    // put your main code here, to run repeatedly:
    int questionNumberArray[] = {0,1,2,3,4,5,6};//the array itself
    const size_t n = sizeof(questionNumberArray) / //the array used
    sizeof(questionNumberArray[0]);//the base of the array

    for (size_t i = 0; i < n - 1; i++) //the loop itself
    {
        size_t j = random(1, n - i);
        int t = questionNumberArray[i]; //integer output for increase
        questionNumberArray[i] = questionNumberArray[j];//the value definition
        questionNumberArray[j] = t;
    }

}

The six buttons are connected to digital pins (1, 2, 9, 11, 12, 13)

Source Link
errr
  • 43
  • 6

A whole basic game project Arduino

Firstly, I know that I have already posted this. I do not think anyone here is stupid so: The game is: a power source connected to 6 buttons connected to 6 LEDs. you press them all in the randomly generated order, and they blink in the order pressed after completion, then randomize and reset.

I have an array shuffler code 1)Does the array shuffler work 2)How do I configure ports and attach them to values in the array, 3) How do I use an if-then statement to say if all buttons pressed in order, then LEDs blink 3 times? I have a picture but not the actual Arduino, so, upon request, I can post the picture. Thank you. code:

void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
int questionNumberArray[] = {0,1,2,3,4,5,6};//the array itself
const size_t n = sizeof(questionNumberArray) / //the array used
sizeof(questionNumberArray[0]);//the base of the array

for (size_t i = 0; i < n - 1; i++) //the loop itself
{
size_t j = random(1, n - i);
int t = questionNumberArray[i]; //integer output for increase
questionNumberArray[i] = questionNumberArray[j];//the value definition
questionNumberArray[j] = t;
}

}