This is a game for Rainbow HAT for Android Things in which the aim is to find the sequence of the ABC buttons to press, which if followed in correct order, will play out the "do-re-mi" melody. The player's seek time is measured for an element of competitiveness.
- Android Things compatible board
- Android Studio 2.2+
- Rainbow HAT for Android Things
- The game starts when the 3 step counter reaches zero and game timer starts
- The player needs to guess the order of the 8-step order of the A, B, C buttons
- When pressed in correct order, the buzzer plays the “do-re-mi” melody, and the led strip lights up the leds one by one, from left to right
- When an incorrect button is pressed a low-frequency sound is played out, the led lights reset and the player has to guess the order from the start
- The round is won when the player completes the sequence after which the alphanumeric display displays
WON!
followed by the time it took the player to win - A game is restarted by pressing on the buttons again, when a new sequence of steps is generated, and next players can attempt to complete their rounds in fastest time
The game makes use of the following individual components provided by Rainbow HAT:
- Buttons
- Gpio Leds
- Piezo Speaker
- Apa102 Led Strip
- Alphanumeric Display
Classes which provide access to these components implement things.supplier.*Supplier
adapter interfaces and contain minimal logic to enable replacing them with other compatible devices, or a subset thereof, or stubs in tests. There are unit tests which do just that in the test
source set. The logic of interaction with the devices is implemented in their respective things.controller.*Controller
classes. A game contains of rounds which are initiated and announced when completed by GameController
class, and Player’s *moves/guesses* are validated by Game
class.
In Android Studio, click on the "Run" button. If you prefer to run on the command line, type
./gradlew installDebug
adb shell am start com.tomaszrykala.dorefindmi/.DoReFindMiActivity
No idea, I’ve used Rainbow HAT (contributions welcome).
As above ;-)
At the moment there are no hints as to what buttons should players press, akin to the popular game Simon (I genuinely did not know of it until a friend told me this project is like it). This should probably be added, because it can be argued that currently winning a game is based on pure luck, with just a little of short term memory requirement :-)
These excellent blogs helped to get this project off the ground:
- Testing Android Things - IoT meets Java
- Testing Android Things – Unit & Vendor tests
- The quick and simple guide to Android Things
- Getting Started with Rainbow HAT
Copyright 2017 Tomasz Rykała
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.