Skip to content
Minnies edited this page Aug 12, 2025 · 3 revisions

Mouselink Documentation

Mouselink is a Python package that emulates Scratch Link, which enables Scratch to connect to hardware peripherals such as a micro:bit or an EV3. Mouselink tricks Scratch into thinking that it is Scratch Link, and allows you to connect Scratch to more then their small selection of hardware peripherals, and to software as well!

You should have a basic knowledge of Python to use Mouselink.

Installation

To install it, use one of these commands:

pip install mouselink
python -m pip install mouselink

You can use the example code found in the examples directory or copy the code below:

from mouselink import mouselink as sl

p = sl.ev3()

def on_got_data(data):
    print(f"Got data: {data}")
    p.send(f"1{data}0") # send back data with additional data

p.on_read(on_got_data)

p.run()

the below information will be updated and completely redone soon, would reccomend waiting until mouselink 2.0.0

Now, to connect it to Scratch, you need to download a SB3 or SPRITE3 file. Here is a Quickstart SB3, which has a sample project inside. Otherwise, look inside the project file folder, and follow the pattern below to find one for you.

DEVICE_VERSION_TYPE_LISTENERTYPE
  • DEVICE: The device type you want to emulate. Currently only EV3
  • VERSION: The version of the file. Always aim for the highest version beginning with the same major version as your Mouselink installation
  • TYPE: The project file type. Either s for a sprite importable into any project, or p for a project template. Always use projects if possible
  • LISTENERTYPE: The activation setting of the data listener. Either runtime (requires the project to be running) or autostart (starts itself automatically when data is incoming). Other types are for examples

Running mouselink

Once you have picked and imported your project file, and set it up how you'd like using the Send custom block, Got message broadcast hat, and latest message variable, you can double click your Python file to start the server.

Note: You must stop the Scratch Link application before starting your Mouselink server.

Go to Scratch and add the extension for your peripheral (currently only EV3), and choose Emulated EV3 from the list. Now Scratch can communicate with Mouselink!

Mouselink needs contributors! Look at the mouselink project or mouselink issues and find something to work on! Submit a pull request and we will review and merge your changes.


If you need help with mouselink, create an issue or ask @minniesworld on their profile!

Clone this wiki locally