A week with Micro:bit

7 thoughts
last posted Dec. 31, 2015, 3:11 p.m.

3 earlier thoughts

0

Project #1: Dice roller

So the plan is to make a simple dice roller application.

  • The buttons should cycle through the various dice from a simple standard RPG poly set (d4, d6, d8, d10, d12, d20)
  • Once a die is selected the player should be able to roll it by shaking the micro:bit.

Possible difficulties:

  • Find a way to distinguish the rolling motion from other types of movement. My gut tells me this will be through detecting certain types of acceleration.

Continued...

I didn't get the chance to work on this yesterday due to Christmas preparations but today I got a couple of hours playing with the Micro:bit again :)

Back to detecting dice rolling, turns out this wasn't too hard but I did need to play a little bit with calibrating the thresholds for detecting consecutive changes in acceleration. There are probably more precise ways to do this, but it works for now!

I created a repo for the rest of the Micro:bit projects and this is the code for the dice roller.

I just realised this is very similar to what Martin O'Hanlon did with his 8-ball shuffle, our solution was actually pretty similar. I had to add some time thresholds as well, otherwise the shake event ended up happening way too easily and offset.

3 later thoughts