All Projects → pybricks → pybricksdev

pybricks / pybricksdev

Licence: MIT License
pybricksdev: Python Package with Pybricks developer tools

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pybricksdev

lego-mindstorms-51515-jetson-nano
Combines the LEGO Mindstorms 51515 with the NVIDIA Jetson Nano
Stars: ✭ 31 (+29.17%)
Mutual labels:  lego, mindstorms
Lego-Mindstorms
Hints, tips, and tricks for the LEGO Mindstorms products (RCX, NXT, EV3, Robot Inventor).
Stars: ✭ 49 (+104.17%)
Mutual labels:  lego, mindstorms
drivecommand
A communication library which connects a robot (EV3, NXT, etc.) and a device (Android, PC, etc.)
Stars: ✭ 13 (-45.83%)
Mutual labels:  lego, mindstorms
ocaml-mindstorm
Library to drive Lego mindstorm NXT bricks from OCaml. Communication with the NXT brick is done through bluetooth.
Stars: ✭ 15 (-37.5%)
Mutual labels:  lego, mindstorms
ev3dev-lang-cpp
C++ language bindings for http://ev3dev.org
Stars: ✭ 58 (+141.67%)
Mutual labels:  lego, mindstorms
epaper-clock-and-more
e-paper clock + weather + AQI + traffic delays - using Waveshare 2.7inch & 4.2inch eink displays running on Raspberry Pi
Stars: ✭ 34 (+41.67%)
Mutual labels:  lego
awesome-lego-universe
Useful guides, tutorials, and FAQs related to LEGO Universe and Darkflame Universe.
Stars: ✭ 34 (+41.67%)
Mutual labels:  lego
OpenLRR
An open source re-implementation of LEGO Rock Raiders 🪨⛏
Stars: ✭ 35 (+45.83%)
Mutual labels:  lego
AWESOME-LDraw
LDraw — awesome software, file format, parts library and model repository (3D models of LEGO® and LEGO-compatible bricks)
Stars: ✭ 30 (+25%)
Mutual labels:  lego
LegoBrickClassification
Repository to identify Lego bricks automatically only using images
Stars: ✭ 57 (+137.5%)
Mutual labels:  lego
node-movehub
Node.js interface for the Lego Boost Move Hub 🤖 🐱 🎸 🚚
Stars: ✭ 57 (+137.5%)
Mutual labels:  lego
l2cu
L²CU: LDraw Linux Command line Utility
Stars: ✭ 14 (-41.67%)
Mutual labels:  lego
ldview
Real-time 3D viewer for displaying LDraw models
Stars: ✭ 65 (+170.83%)
Mutual labels:  lego
lego-face-VAE
Variational autoencoder for Lego minifig faces
Stars: ✭ 15 (-37.5%)
Mutual labels:  lego
powered-up
.NET implementation of the LEGO PoweredUp Protocol
Stars: ✭ 65 (+170.83%)
Mutual labels:  lego
lego-boost-app
React Application for controlling Lego Boost from the browser with Web Bluetooth API
Stars: ✭ 57 (+137.5%)
Mutual labels:  lego
boats-animator
Stop motion animation program created using Electron
Stars: ✭ 61 (+154.17%)
Mutual labels:  lego
NanoJ-Fluidics
Manual, source-code and binaries for the NanoJ-Fluidics project
Stars: ✭ 47 (+95.83%)
Mutual labels:  lego
PiStorms
PiStorms code, libraries and setup.
Stars: ✭ 20 (-16.67%)
Mutual labels:  mindstorms
lego-art-remix
Powerful computer vision assisted Lego mosaic creator · Over 500,000 images created (so far!)
Stars: ✭ 148 (+516.67%)
Mutual labels:  lego

Coverage Status Documentation Status

Pybricks tools & interface library

This is a package with tools for Pybricks developers. For regular users we recommend the Pybricks Code web IDE.

This package contains both command line tools and a library to call equivalent operations from within a Python script.

Installation

Python Runtime

pybricksdev requires Python 3.8 or higher.

Command Line Tool

We recommend using pipx to install pybricksdev as a command line tool.

We also highly recommend installing pipx using a package manager such as apt, brew, etc. as suggested in the official pipx installation instructions.

And don't forget to run pipx ensurepath after the initial installation. This will make it so that tools installed with pipx are in your PATH. You will need to restart any terminal windows for this to take effect. If that doesn't work, try logging out and logging back in.

Then use pipx to install pybricksdev:

# POSIX shell (Linux, macOS, Cygwin, etc)
PIPX_DEFAULT_PYTHON=python3.8 pipx install pybricksdev

Setting the PIPX_DEFAULT_PYTHON environment variable is only needed when pipx uses a different Python runtime other that Python 3.8. This may be the case if your package manager uses a different Python runtime.

Windows users

If you are using the Python Launcher for Windows (installed by default with the official Python installer), then you will need to use py -3.8 instead of python3.8.

py -3.8 -m pip install --upgrade pip # ensure pip is up to date first
py -3.8 -m pip install pipx
py -3.8 -m pipx ensurepath
py -3.8 -m pipx install pybricksdev

Linux USB

On Linux, udev rules are needed to allow access via USB. The pybricksdev command line tool contains a function to generate the required rules. Run the following:

pybricksdev udev | sudo tee /etc/udev/rules.d/99-pybricksdev.rules

Library

To install pybricksdev as a library, we highly recommend using a virtual environment for your project. Our tool of choice for this is poetry:

poetry env use python3.8
poetry add pybricksdev

Of course you can always use pip as well:

pip install pybricksdev --pre

Using the Command Line Tool

The following are some examples of how to use the pybricksdev command line tool. For additional info, run pybricksdev --help.

Flashing Pybricks MicroPython firmware

Turn on the hub, and run:

pybricksdev flash <firmware.zip>

Replace <firmware.zip> with the actual path to the firmware archive.

Running Pybricks MicroPython programs

This compiles a MicroPython script and sends it to a hub with Pybricks firmware.

pybricksdev run --help

#
# ble connection examples:
#

# Run script on any Pybricks device
pybricksdev run ble demo/shortdemo.py

# Run script on the first device we find called Pybricks hub
pybricksdev run ble --name "Pybricks Hub" demo/shortdemo.py

# Run script on device with address 90:84:2B:4A:2B:75 (doesn't work on Mac)
pybricksdev run ble --name 90:84:2B:4A:2B:75 demo/shortdemo.py
       
#
# usb connection examples:
# NOTE: running programs via usb connection works for official LEGO firmwares only

# Run script on any Pybricks device
pybricksdev run usb demo/shortdemo.py

#
# Other connection examples:
#

# Run script on ev3dev at 192.168.0.102
pybricksdev run ssh --name 192.168.0.102 demo/shortdemo.py

Compiling Pybricks MicroPython programs without running

This can be used to compile programs. Instead of also running them as above, it just prints the output on the screen instead.

pybricksdev compile demo/shortdemo.py

pybricksdev compile "print('Hello!'); print('world!');"

This is mainly intended for developers who want to quickly inspect the contents of the .mpy file. To get the actual file, just use mpy-cross directly. We have used this tool in the past to test bare minimum MicroPython ports that have neither a builtin compiler or any form of I/O yet. You can paste the generated const uint8_t script[] directly ito your C code.

Additional Documentation

https://docs.pybricks.com/projects/pybricksdev (work in progress)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].