Program RVR+/RVR with the micro:bit Python Editor

The micro:bit Python editor is a fantastic, web-based option for those relatively new to programming in Python. Getting up and running is fast and easy.

Download the Sphero Library

First things first, you need to download the micro:bit Python SDK. This module contains the set of commands that allow the micro:bit to communicate with your Sphero RVR+ or RVR.

Go to Sphero’s GitHub repo and select the “Download Zip” option under the green “Code” button!

Unzip the folder and locate the file. Nolte: You can also choose to download only the file instead of downloading the entire folder.

Add the Sphero Custom Library

Open the micro:bit Python editor, so you can add the Sphero module and get started programming.

Select “Open” in the left panel to get started adding the file that you just downloaded. Select the file in your computer’s file structure.


Select the small gear icon above the “Confirm” button. We do not want to replace the main code with 

Select “add file”. 

Now, select “Confirm”. You should see both and in your project files. 

The file includes the modules to control micro:bit. The file includes the modules to program your RVR+/RVR with micro:bit. You are ready to create your first program.

Create a Simple Program

The micro:bit Python editor has lots of great features designed to help programmers learn Python, including a reference section, drag and drop code snippets, auto-complete, and more. Reference micro:bit’s getting started materials to learn more about the editor.

For now, let’s create our first program. Delete the existing code in the project. Then copy and paste the following code into the editor.

# Imports go at the top

from microbit import *

from sphero import *

import time

# Code to run when program starts

# Wake up RVR and pause for 2 seconds



# Set all LEDS to yellow

RVRLed.set_all_leds(255, 255, 0)

# Run through a loop four times to drive forwards and backwards for 2 seconds

for i in range(4):,0)



IMPORTANT: You probably noticed that some features of the editor like the reference section only apply to micro:bit library. Refer to the Sphero SDK for micro:bit page for documentation about the commands available in the Sphero SDK.

Flash the Program to your micro:bit

Like MakeCode, the micro:bit Python editor has two ways to flash—or transfer—a program to your micro:bit.

For more information on flashing programs from micro:bit’s Python editor, refer to their support site.

Run the Program on RVR+/RVR

Now that your program is downloaded onto the micro:bit, it’s time to run it on your RVR+ or RVR.

Disconnect the micro:bit from your computer, then plug it into your powered-off RVR+/RVR.

Press the RVR+/RVR power button and watch the program run!

Go Further

See more examples of what you can accomplish with your RVR+ or RVR and the micro:bit SDK.