Introduction: Arduino Cyclone Arcade Game
Blinky flashy lights! Arduino! Game! What more need be said? This game is based off of the Cyclone arcade game, where the player tries to stop an led scrolling around a circle at a specific spot.
Step 1: Materials
1x Arduino Uno
3x Jumper Wires
1x WS2812B LED Strip(I bought mine for $30 from Amazon here)
Step 2: Code
Download the Arduino IDE from www.arduino.cc/en/Main/Software
Download the latest version of the FastLED library from https://github.com/FastLED/FastLED/releases
Install the library in the Arduino IDE following the instructions here: https://www.arduino.cc/en/Guide/Libraries
Download the code for this project from here.
Unzip the code and open it in Arduino by double clicking on LEDGame.ino.
Step 3: Wiring
Connect the three jumper wires to the led string. Connect the first wire from the 5v pad on the LED strip to the 5v pin on the Arduino. Connect the second wire from the Din pad on the LED strip to digital pin 7 on the Arduino. Connect the last wire from the Gnd pad on the LED strip to Gnd on the Arduino. You may need to solder these wires to the pads on the LED strip. WARNING: Connecting more than 30 leds to our Arduino can cause over current damage to the onboard regulator or USB power supply.
Step 4: Upload the Code and Run!
Open the code in the Arduino IDE. Replace the number 27 on line 24 with the number of leds. Determine which led should be the center led and substitute that for the number 14 on line 27. Click upload to upload the program to the board. Make sure to select the correct board type and port from the tools menu. Then open the Serial monitor, set the baud rate to 9600, and follow the on screen prompts.
Step 5: How Does the Code Work?
The code is a simple state machine, running in either a game running or game over state. A for loop moves the led along the string until input is received over Serial. Then the game switches to the game over state and calculates the distance of the led from the center of the string.
Step 6: Thanks for Reading!
If you liked this Instructable, please consider favoriting it, and please check out my blog here. Thanks for reading, and if you have any suggestions or changes, leave them in the comments below.
We have a be nice policy.
Please be positive and constructive.