The micro:bit (https://www.microbit.co.uk/about) has been in the press quite a bit recently - rightly so.
At the moment I have not got my hands on an actual one, though someone generously (more in later posts on that) will be lending me one to play with.
Luckily you do not need the device to start playing; the code editor (https://www.microbit.co.uk/create-code) has an emulator built in, so you can start playing. This post reports on my first go.
So, I am starting with experimenting with the editor, using Microsoft's Block Editor - which is similar to Blockly and Scratch as an interface.
What I built is simple but that is fine - A dancing bot - 3x3 box for the body, with two legs. I wanted to play with getting some interaction that uses the buttons (A and B) and shaking. So the functions for the idea were:
- Button A - make it bob up and down;
- Button B - makes it move to the left and right;
- Shaking it - makes it appear to jump and land (see below);
- Button A+B together makes it do one of the moves of up, down, left and right.
The video below shows it action.
The other nice thing is go convert to the Microsoft touch Developer version (see below) with a click.
Now to be repeat most of this just using events.
So the functions for the idea were:
- Button A - make it bob up and down;
- Button B - makes it move to the left and right;
- On shake - make it jump up and down.
Thanks to a loan of a Micro:Bit from Lancaster University I can experiment with an actual micro:bit (@SCC_Lancaster @LMcUnderwood)
Experiment 1 - Using the buttons
So the functions for the idea were:
- Button A - Move to the left and then back to the starting position;
- Button B - Move to the right and then back to the starting position;
- Buttons A+B - Jump up and then back to the starting position;
- Shake - 'Crouches' and then back to the starting position
On the Microbit
Experiment 2- To add left and right tilting to it.
So if the micro:bit is tilted to the right the 'bot' moves to the right, and the same for the left.
The tilting operation here is essentially - when the x on the accelerometer is less than zero move the 'bot' to the left and when it greater than zero go to the right.
Video showing it in action
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
No comments:
Post a Comment