Tuesday, 30 June 2020

A Bit Of Balance

So - back to teaching the kids how to code - and in the latest lesson we introduce the accelerometer. 

To start with I wanted them to see how the accelerometer behaved as the micro:bit was moved around, so we output the values to the serial port and started up the console monitor. (The example below shows the simulator, but during the lesson, we were connected to the micro:bit and viewing the remote console.)


Accelerometer To Serial
Code to write accelerometer values to serial port

Output from serial port on console monitor


Monday, 22 June 2020

Chuck a Duck - The Lesson That Never Was

Now that we'd been introduced to radio communications, the next step was to use this feature to write a game. 

I had seen the 'group teleporting duck' game on the micro bit projects page at https://microbit.org/projects/make-it-code-it/group-teleporting-duck/ and thought that would be a good basis for a game. 

This project would be a little more complicated that what we've been doing to date, so I decided to write this myself first before going through the process in a lesson.   

The idea of the game is: 

  • Each player has their own micro:bit. At startup, they can press the 'A' button to cycle through a list of id's (1-4 in a 4 player game). 
  • Once everyone has a unique number, one player starts the game by pressing the 'A' and 'B' buttons together. This transports the duck to a random micro:bit. 
  • The player that receives the duck has to shake the micro:bit to 'chuck' it to another random micro:bit. The game continues for 20 seconds and the player left with the duck at the end will lose the game.