Bongo Hero was created for the "Fête de la science," an annual event in France to promote science and technology. I am currently a software developer at Orange labs in Caen, and for this event we opened our labs to the public and built demonstrations, Bongo Hero was one of them. The goal of this demonstration was to show how we could build things easily thanks to Arduino.
This tutorial shows how to build Bongo Hero using four LED strips of one meter each (30 LEDs per strip), but the code is easily configurable, so you can build your own version with the number of strips you want, the number of LEDs you want, and even adapt the difficulty of the game.
To test the LED strips and the FastLed library that is used, there is a very nice tutorial showing the possibilities offered by the library. I followed it to get started with the strips and the library.
The four strip must be connected to digital pin 2, 3, 4 and 5 as you can see in the setup function:
FastLED.addLeds<LED_TYPE, 2, COLOR_ORDER>(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); FastLED.addLeds<LED_TYPE, 3, COLOR_ORDER>(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); FastLED.addLeds<LED_TYPE, 4, COLOR_ORDER>(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); FastLED.addLeds<LED_TYPE, 5, COLOR_ORDER>(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip);
The Arduino official example for using a piezo element is very well explained.
The four piezo elements must be connected to analog pins A0, A1, A2, A3.
To sum up:
Led strip digital pin | Piezo element analog pin -------------------------------------- 2 | A0 3 | A1 4 | A2 5 | A3
At the beginning of the source file, you'll find preprocessor directives that will enable you to adapt the difficulty and the gameplay of the game.
Here are the most useful:
#define MIN_INTERVAL 5 // the minimum number of leds switched off between two tiles #define LEVEL_DURATION 5 // number of successful tap before level up #define MIN_TILE_DELAY 50 // in milliseconds, minimum duration for a tile in a position #define MAX_TILES_PER_STRIP 3 // the maximum number of tiles present at the same time on a led strip #define TILE_GENERATION_PROB 15 // probability to generate a new tile when possible the smaller it is, the more likely it is to generate one #define LEVEL_SPEED_INCREASE 5 // in milliseconds, increase the speed of the led strip refresh rate when level