Drawing With The :MOVE mini For The microbit
The :MOVE mini has a hole in the boot lid designed to accept a marker pen, such as a Sharpie, for line drawing. All it takes is a sharpie and some code... drawing with the move mini This guide will show you how to get started with both the PXT editor for the BBC microbit using both blocks and also JavaScript.  

Make The :MOVE mini Draw A Circle (MakeCode) :

To draw a circle the outside wheel must move faster than the inside one. On a :MOVE mini we have independently controllable wheel speeds. When the wheels are going in opposite directions the :MOVE mini will turn on the spot, and then as the wheels become close to the same speed it will make a larger, and larger circle, until it ends up going in a straight line. This code draws a small sized circle by running one motor at full speed, and one motor at 1/3 speed. You can edit the radius of the circle by altering the write speed. Use a write speed from 90 – 0 for one servo and 90 – 180 for the other, where 0 and 180 is a straight line (allowing for variance in servos it will probably drift to one side or another).  

Make The :MOVE mini Draw A Shape (Javascript):

A square has 4 equal sides and 4 90 degree corners. We will write a program for this in JavaScript. Because there are 4 corners and 4 edges it is worth writing control functions for turning and driving to do this, rather than writing the same code 4 times. In the MakeCode java editor create the following variables. We will use these to store some constants about our :MOVE mini. drawing with the move mini 02 - constants Next we will make a function that takes the desired number of degrees to turn and drives the servos to achieve that. Because we do not have position feedback from the 360-degree servos we have to use time and a knowledge of how fast the :MOVE mini is to make the turn. To do this we will turn on the servos, wait a period, and then turn them off. The following function turns left through approximately the requested number of degrees. drawing with the move mini 03 - turn left Program button A to call this function like this (note: there is a pause to allow you to move your hand before the :MOVE mini starts turning). You can fine tune the number of degrees per second constant so that the :MOVE mini turns through 90 degrees. Next make a function to cause the :MOVE mini to drive forwards: drawing with the move mini 05 - forwards Program button B to call this function like this: drawing with the move mini 06 - button b Fine tune how far the :MOVE mini drives by changing the distance per second constant. You might want to make it 10cm for a 10 for instance. Now we have the building blocks to make the :MOVE mini draw a shape. To draw a square when button A is pressed change the code in the onButtonPressed function to: drawing with the move mini 07- square This will draw a basic 4 sided shape, which if your turns are accurate will be a square. For further tasks see if you can write code to make the :MOVE mini turn right, and drive backwards. Combine that code to draw other shapes/pictures.  

Kitronik Custom Blocks For The microbit Javascript Block Editor:

We’ve also created some custom blocks for the microbit Javascript Block editor. These can be found in the Extensions browser in the MakeCode Editor. In the JavaScript Block editor click the ‘Advanced’ button in the toolbox, then click the ‘Extensions’ button and type in Kitronik. A list of all of our custom blocks will then be displayed. Click on the Servo:lite tile and it will be added to your coding menu. Simply click on it to add it to the project. You will now have access to the following blocks:  

Downloads: 

For those that want to get drawing straight away, we've included the zip file below that contains all of the code above as three separate hex files.
  • You can download the code here.
Note: Unzip the file and either drag the HEX file into the MakeCode editor for editing or connect your microbit to your computer and drop the file directly onto your microbit via your file explorer. The microbit should show up as a removable drive.

Leave a comment

All comments are moderated before being published