This repo contains python code to operate various lego projects.
- PyEnv
- Poetry
In the terminal:
- Update Homebrew and install it:
brew update
brew install pyenv
- Set up the shell environment for PyEnv for ZSH:
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
- Install python 3.8.6 using PyEnv
pyenv install 3.8.5
pyenv global 3.8.5
- Install poetry using the following command:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
- Add Poetry's bin directory to PATH environment variable.
source $HOME/.poetry/env
- Set virtual env in project root.
poetry config virtualenvs.in-project true
- Create python environment with all dependencies:
poetry install
- Activate python environment:
source .venv/bin/activate
This project runs on LEGO® MINDSTORMS® and SPIKE® hubs. Follow these steps to get started:
- Install the Pybricks firmware on your hub by following the official instructions
- Connect your hub to your computer via Bluetooth using the Pybricks web-based code editor at least once.
- Run the following command in your terminal:
make run
You should hear a beep, and the hub's display will show "Hello world!".