For a school project we would like to create a game. The game involves 4 sensors: a button, the lineair potentiometer, the rotentional potentiometer and the touchsensor. We also use a Neopixel ledstrip with 8 LEDs and a servomotor. By touching the touchsensor a new sequence (8 steps) is generated. The player must use the button, the lineair potentiometer and the rotational potentiometer in the correct order. If the 8 steps are executed in the right order, the servomotor will turn 90° and the LEDstrip is supposed to show a rainbow effect.
Every right step will show a green LED light (if the first step is correct the first LED will light up). If the second step is incorrect, the second led on the ledstrip will show a red light and the player must start again from the first step in the sequence. This goes on until the player has executed the 8 steps in the correct order.
We think our project is almost finished but we can't get through the last step: which is letting the Arduino know that when the 8 steps are executed correctly, the servomotor must turn 90 degrees and the ledstrip must show a rainbow effect. Right now we coded this by saying 'while ( i == 8)', but this doesn't seem to work.
Can anybody spot a mistake in our code?
Thanks!
Test1912.ino (4.95 KB)