Python project that emulates Scratch Link, and allows communication between Scratch and Python.
Project description
Mouselink
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!
Installation
To install it, use:
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 some additional data
p.on_read(on_got_data)
p.run()
Features (and planned ones)
Implemented:
- Add an EV3 to the device list
- Allow Scratch to connect to that EV3
- Transmit data as that EV3
Planned
- Support connecting as other peripherals
- micro:bit
- WeDo 2.0
- Communication using the Translate extention's data saving glitch
How does it work?
I investigated Scratch's communication with Scratch Link, and discovered it uses a plain, unencrypted WebSocket server. I own an EV3, so I used my web browser's developer tools to monitor the data sent between Scratch and Scratch Link. I then began writing Mouselink, using my real EV3 communication as reference for the protocol. After a few days, I could connect an emulated EV3 device and have it be recognised by Scratch, and a few days after that I could transmit data between Scratch and Mouselink.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mouselink-1.0.0.tar.gz.
File metadata
- Download URL: mouselink-1.0.0.tar.gz
- Upload date:
- Size: 47.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02147a31fa6523246630bd208cc62f674a62a81e14fe62f84a40d15df0042a69
|
|
| MD5 |
8a8feb5b5221038be13bd45a00df4c3f
|
|
| BLAKE2b-256 |
ccf72fad792e13b150d46e175dc2333654c2db04f06a9d260d90efe36b2fcb2f
|
File details
Details for the file mouselink-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mouselink-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed1a2b0952e138f6c8199ab43481646496c6de4887101375b699fbb13378d3a3
|
|
| MD5 |
99a0aad190b84ea7ccddf22d2d4daa55
|
|
| BLAKE2b-256 |
f495d5c9408ec877f7b1a6289e92bff617cf43d574d490141f2a39aa075c01fb
|