One of the many quintessential 90s kid experiences is going to your friend's house to play co-op games, maybe some Tekken, just to be handed one of these:
You look confused. Your buddy assures that the controller is "just as good". You pick up the controller and feel that something is rattling inside. This thing is coming apart any time. The only saving grace here, is the often present turbo mode. Turn it on, and now the controller rapid fires, whenever it decides to actually work, so you can pull off one of these:
It doesn't make much of a difference since you still inevitably get wiped out, but hey, maybe we can turn that painful memory into something cool. Let's add a "turbo" rapid fire mode to the BeatBox. Check out how it works!
Ok so first of all, if you are not yet familiar with the firmware flashing process, please refer to our previous blogpost at: https://www.rhythmo.io/post/android-firmware-recall-info-how-to-fix-it-yourself-with-an-arduino-uno
You'll need an Arduino Uno to act as an AVI programmer, and basically, just upload this firmware file that has the updated turbo function.
That's it! Now, in mode 1, once you hold down the Shift button, the next note button that you trigger will repeat in 50ms intervals. You can control the repeat speed by using the 4th knob on the BeatBox while holding down Shift.
That's the TL;DR version, but obviously we are not going to end there. Let's briefly talk about the code here so you can perhaps customize the turbo function, or maybe get some ideas on how to put in additional functions. The way that the BeatBox functions is very simple. Once turned on, the chip basically scans every single button and knob constantly to detect movements. You can see this very clearly in the loop function:
The buttons are set up in a 4x6 matrix, hence the keys[j][i] expression.
First of all, we declared a counter for trigger repeat time, and a condition about if turbo mode is on, as you can see on lines 98-99:
Now, we'll go to the keyPressed function to put in the turbo mode activation codes, starting on line 328. Lines 341-413 are behaviors under mode 1, which is the generic midi controller mode. Starting from line 363, we'll look at what the controller does once Shift is held down, and a note button is pressed.
If a note button is detected, and shift is held down, turbo mode gets turned on. Once in turbo mode, the program starts to loop within the turbo mode, until turbo is turned off. As you can see, turbo mode sends a note on, and a note off signal, then counts the entire turboCount duration, which is set to 50 at default, during which it checks for the encoder movement every 1ms to see if the turbo duration is changed.