Tuesday 16 August 2016

Micro Alarm

This is our first hardware project - an alarm. It's (very) inspired by Tech Will Save Us' Micro Guardian. The project is pretty simple, but it's a fun one to make. We set up the micro:bit with a connection between pins 0 and 3v using crocodile clips attached to two strips of copper tape. The copper tape goes across the seal of a jar, making a connection when it's closed and breaking it when it's open. We detect this in the code and, when the connection is broken, we output a pulse to pin 1 which has a buzzer connected to it (the other connection of the buzzer goes to GND). We also used some of MicroPython's built-in images to show the micro:bit asleep face when the connection is closed, and alternating between angry face and sword (Son was insistent that the micro:bit show you that it is both angry and ready to fight you) when open.


Monday 8 August 2016

Snake

Here's our second game, a version of the classic snake game. A bit of a challenge to fit this onto a 5x5 display with only two buttons but we think we've managed it. Drive the snake around the screen using the A and B buttons to turn left and right. The aim is to eat the food (the flashing pixel) but your snake gets longer each time it eats something. Eventually your snake tail will be so long that you'll crash into it and it's game over!


Friday 5 August 2016

Non-Flappy Bird

Here we present our first micro:bit game - Non-Flappy Bird. We wanted to write a version of Flappy Bird, but on a 5x5 display there didn't feel like there was enough room for flapping. So instead of flapping, we made the A and B buttons move you left and right. Rows of lit pixels drop down the screen towards you and you'll need to dodge them. The game gets faster the more barriers you avoid.


Thursday 4 August 2016

Custom Display Clear

MicroPython has a simple built-in command to clear the display: display.clear(). The results are equally simple - it instantly turns off every LED on the display. We don't need to be limited to such a simplistic way of clearing the screen though, we can write our own exciting fades, wipes and dissolves.


Wednesday 3 August 2016

Built-in Images

The micro:bit's MicroPython has a big list of built-in images - 63 to be precise. But what do they all look like? Well, here's a handy chart! And as a bonus, we've also included a test program that cycles through all the images on the micro:bit's display.


Tuesday 2 August 2016

Electronic Die

So here's our first program - an electronic die. OK, so technically this is the second program - we went from the ultra-simplicity of "Hello, World" straight to here. The program's operation is pretty simple - every time you shake the micro:bit you get a new random number displayed on the screen in the image of a traditional six side die. We found that the shake gesture was pretty hit-and-miss so we made it that you can also press the A button to roll. We expected the gesture recognition to be better, so maybe we're doing it wrong? Suggestions welcome!