My Cart:

0 item(s) - £0.00
You have no items in your shopping cart.


Kitronik Custom MakeCode Editor Servo Blocks

We’ve released several new robotics products recently that make use of servos to provide movement. We recognised that creating code to control these servos can become time-consuming, especially if you are experimenting or re-purposing your robots projects regularly. With that all in mind, we thought it would be useful to create some custom blocks for the MakeCode editor that anyone can use and that make the job of coding for 360 degree continuous servos as quick and as painless as possible.

adding a servo
We expect our blocks to become a part of the MakeCode menu sometime soon, in much the same way that Bluetooth and NeoPixels are now, but until they are they will have to be added to the MakeCode menu from the Git Hub. We’ll show you how to add our custom servo blocks to the MakeCode menu and run through what each block does.


Kitronik Custom MakeCode Editor Servo Blocks:

Kitronik has created some custom blocks for the microbit Javascript Block editor. These can be found in the Kitronik github. For the Servo:Lite board that is in the :MOVE mini kit for the BBC microbit, the address is:

In the JavaScript Block editor click the ‘Advanced’ button in the toolbox, then click the ‘Add Package’ button and type in/copy and paste the github URL (shown below). Press the search magnifying glass and the package should appear:

adding a package

Simply click on it to add it to the project. You will now have access to the following blocks:

kitronik custom blocks menu

Now that we know how to add them to the MakeCode Editor we’ll have a look at each block individually to see what they all do, most are as straight forward as they look but a couple warrant a little explanation.

For most applications, ie coding a remote control buggy, the Forwards, Backwards, Turn Right, Turn Left and Stop commands are all that should be required. However, if you are writing code for a drawing robot or a robot arm then you will need to calibrate turn speed and forward speed and use commands such as Turn left x degrees, which offers greater precision.


The Blocks:

Note: These blocks were written specifically for coding for the :MOVE mini buggy, however, if you are using 360 degree continuous rotation servos orientated in the same way as in :MOVE mini then the directional blocks will work in the same way.


Allows the setting of the :MOVE mini forward/reverse speed. The allows tuning for the drive forwards and drive backwards x distance commands.

block image

Turns right through the requested degrees and then stops. This needs the calibrate turn speed to x degrees per second tuned to make it accurate, as it uses a simple turn, wait, stop method. It also runs the servos at a slower pace than the right function to reduce wheel slip.

block image

Drives backwards the requested distance and then stops.

block image

Drives forward the requested distance and then stops.

block image

Sends servos to a neutral position. On a well trimmed 360 degrees servo this is stationary, on a normal 180-degree servo this is 90 degrees. This is especially useful for coding servos that will be performing tasks other than driving wheels, for example, a servo that is controlling a steering rack or part of a robot arm.

block image

Stop for 360-degree servos, rather than write 90 as in the ‘goto neutral position’ block, which may or may stop the servo depending on how well trimmed it is. The Stop command literally stops sending pulses to the servo. On a normal servo, this will stop the servo where it is rather than return it to a neutral position, it will also not provide any holding force.

block image

Turns right, call ‘stop’ to stop.

block image

Turns left, call ‘stop’ to stop.

block image

Drives backwards, call ‘stop’ to stop.

block image

Drives forwards, call ‘stop’ to stop.

block image

Allows the setting of the :MOVE mini turn speed. This allows tuning for the turn x degrees command.

block image

Turns through the requested degrees and then stops, needs NumberOfDegreesPerSec tuned make it accurate as it uses a simple turn, wait, stop method. Runs the servos slower than the turn left block to reduce the chance of wheel slip.

Electronic Project Kits
← Previous Post Next Post →

2 thoughts on “Kitronik Custom MakeCode Editor Servo Blocks”

  • David Held July 1, 2017 at 2:25 pm

    Can the servo blocks be used without having your servo board?

    • Mark Donnison July 5, 2017 at 12:15 pm

      Hi David, yes they can be used with other servos but you will need to take into account the following info. The code breaks out to P1 & P2 for use with the :MOVE mini kit. The servos will need a separate power supply to the micro:bit. We will be adding more blocks soon that will increase their usefulness for a wider range servo based activities.

Leave a Reply