The project started out as a user interface to control an MP3 player. Adding a kid lead to a lot of skipping and other interruptions during playback. Seeing how the kid got around the kids lock on the washing machine in five minutes, I decided not to go that way. Instead I changed the project in a game for kids to distract him from the other gadgets around.
The player uses data from an SD card:
- screens
- images
- sounds
The .scr (screen) files tell the player what to do. They are in the JSON (http://www.json.org) format and look like this:
{
"Init": {
"image": "4_car.bmp",
"color": "0xFFFFFF"
},
"B1": {
"sound": "wrong.snd"
},
"B2": {
"sound": "wrong.snd"
},
"B3": {
"sound": "wrong.snd"
},
"B4": {
"sound": "good.snd",
"screen": "main.scr",
"color": "0x00FF00"
}
}
After loading a .scr file, the player executes the "Init" section. The sections "B1" through "B4" are executed in response to pressing one of the 4 buttons.
All sections can have the same fields:
- "image" will put the image on the LCD panel.
- "color" sets the color of the RGB backlight LED of the LCD. The color is specfied in RGB hexadecimal format. So 0xFF0000 is red, 0x00FF00 is green, 0x0000FF is blue.
- "sound" will play the sound from the file. The sound editor "Audacity" was used to create the files. The format is headerless, unsigned 8 bit, mono and 44.1kHz sample rate.
- "screen" tells the player to load another screen.
Comments