Introducing the Maqueen Robot


Our friends at DFROBOT made a small, MicroBit compatible robot. But don’t underestimate it by its size! This small robot has a bunch of options for controlling the distance sensor to avoid obstacles to being able to follow a line. We built our own extension for it and this post is a guide on how to use it in Microsoft MakeCode.

How to use

Add the extension

If you have not installed an extension before, check out this post about how to install extensions.

Otherwise, enter the following link when prompted.


Let’s start with the basics by controlling the motors. In the following example, we set the robot to go forward for 2 seconds, backward for 2 seconds and then stop. Check out the code below.

MakeCode Motors Example

Headlights and Underglow

Another simple task is controlling the headlights (the two orange bulbs on the front) and the underglow (the 4 white squares in each corner). The underglow, in this case, is being controlled by the Neopixel extension. The following program flashes each headlight and gives a breathing light effect to the underglow. Check out the code below.

MakeCode Lights Example

Distance Sensor

Something a little more advanced would be interacting with the distance sensor on the front of the robot.

In this example, we want the robot to avoid all obstacles within 30 centimeters in front of it by going backward and to the right when an object is within that range. If you look carefully, this is the same thing the robot is doing in the image at the top! Check out the code below and try changing it to avoid things at a farther distance or to turn a different way.

MakeCode Obstacle Avoidance Example

Line Sensor

Line sensing is probably the trickiest of them all since the robot is always correct itself to stay on the line.

As you can see, the line sensors are pretty small but are pretty accurate in detecting a line. The robot also gives you two handy blue LEDs that will turn off when there is no line and will turn on when it detects a line!

The following code is pretty long but it will start to make sense after seeing it in action. To sum it up, as long as both sensors don’t see a line, it will go forward, but if one side sees a line, the opposite motor will stop causing the robot to turn and to get back on track. Check out the code below to see the full example!

MakeCode Line Following Example!

I have two DF Robot Micro Maqueens. They are great teaching tools ! The link you have posted in the first line about the MakeCode extension is for the URL on Github. Usually, in my experience, I can copy that link and insert it by pasting into the search box of extensions in MakeCode and the extension will then appear and clicking on it will install into the MakeCode program. In this case it does not. Makecode says it cannot find the extension. Only by copying and pasting the title of the extension, not the URL , works. I know not why.

So rather than be a complainer, I decided to make a simple program with the extension already installed and “share” it on a comment in a Maqueen video on YouTube. In comments below the video you may have to click on “newest” to see the link that I posted. If you click on that link to the MakeCode program and then click Edit at the top of the MakeCode program you should see the Maqueen tool installed.

1 Like

“Network Request Failed” that’s the message that I get when I click on the “share” program links posted here. Don’t know if anyone else gets that message. I tried pasting the copied URL for the share program into my IMPORT box but it will not appear, in standard MakeCode nor in Beta # editor. I’m in Chrome with a MS Surface notebook.

What I found out is that “” doesn’t work but this works “”. I only deleted the “/”.

Hey Frank, I really enjoyed the video! It is nice to see people getting involved with programming at such a young age!

As Gus already said, having the last backslash in “” causes the extension not to appear for some reason. I have since updated the post with the correct link.

Regarding the “Network Request Failed” message, I am getting this error as well when I use the link and unsure of as to why. I will look further into this and respond tomorrow with an update. Thank you for letting me know.

I am not getting any errors. I am using Chrome.

“Network Request Failed” fixed for me using Chrome. I updated the 4 examples with new links, and still has same code. It should allow you to view the project now. Let me know if the problem is still happening. Thank you