https://github.com/mgross21/spikeble
BLE interface for running MicroPython on LEGO® SPIKE™ devices.
https://github.com/mgross21/spikeble
accessibility ble bluetooth educational lego micropython python robotics spike wireless
Last synced: 2 months ago
JSON representation
BLE interface for running MicroPython on LEGO® SPIKE™ devices.
- Host: GitHub
- URL: https://github.com/mgross21/spikeble
- Owner: MGross21
- License: other
- Created: 2025-08-09T22:29:14.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-19T22:41:52.000Z (10 months ago)
- Last Synced: 2026-04-13T01:34:42.814Z (2 months ago)
- Topics: accessibility, ble, bluetooth, educational, lego, micropython, python, robotics, spike, wireless
- Language: Python
- Homepage:
- Size: 3.67 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
(pronounced "spike-able")
## Installation
*From PyPI:*
```console
pip install spikeble
```
*From GitHub:*
```console
pip install git+https://github.com/MGross21/spikeble.git
```
> **⚠️ Warning:**
> It is **highly recommended** to install and use this library within a Python virtual environment. Installing `spikeble` will expose all MicroPython modules (such as `app`, `color`, `color_matrix`, `color_sensor`, `device`, `distance_sensor`, `force_sensor`, `hub`, `motor`, `motor_pair`, `orientation`, and `runloop`) as direct imports in your environment. Using a virtual environment prevents conflicts with other Python projects and keeps your global Python installation clean.
>
>
> Making a Python Virtual Environment
>
> ```bash
> python -m venv .venv
>
> # Activate the virtual environment
> # On Windows:
> venv\Scripts\activate
>
> # On macOS/Linux:
> source venv/bin/activate
> ```
>
> Once activated, you can install `spikeble` and other dependencies.
>
>
## Running Code on SPIKE
To enable auto-complete for MicroPython APIs, place all MicroPython imports inside your `main()` function.
Use the template below as a starting point for your SPIKE code:
```python
import spikeble
import asyncio
def main():
# from app import sound, bargraph, display, linegraph, music
import color
import color_matrix
import color_sensor
import device
import distance_sensor
import force_sensor
from hub import port, button, light, light_matrix, motion_sensor, sound
import motor
import motor_pair
import orientation
import runloop
### Insert Your Code Here ###
if __name__ == "__main__":
asyncio.run(spikeble.run(main))
```
> **Note:**
> As of `SPIKE™ Firmware v1.8.149` and `RPC v1.0.47`, using `import app` or `from app import ...` will result in an import error. The `app` module is currently disabled until further notice.
### Other Send Methods
You can also run code on the SPIKE using the following methods:
```python
spikeble.run_file("path/to/your_script.py")
```
```python
spikeble.run_str("print('Hello from SPIKE!')")
```
## Documentation
- [MicroPython Docs](https://spike.legoeducation.com/prime/modal/help/lls-help-python)
- [Communication Protocol](https://github.com/LEGO/spike-prime-docs)