Skip to content

pybricks

Elvin Slavik edited this page Nov 28, 2021 · 5 revisions

Pybricks for smart LEGO® hubs

Getting started

The brief instructions below describe how to create a build of Pybricks for LEGO® MINDSTORMS EV3 with usqlite included. The instructions assume you have already have installed the the development tools and have configured a EV3 MicroPython micro SD card. For more details on setting up your Pybricks development environment also refer to www.ev3dev.org. Details on getting started with Python programming on the EV3 can be found in the LEGO Education guide - Getting started with LEGO® MINDSTORMS® Education EV3 MicroPython

  • Clone the Pybricks repository into your project folder (e.g. bricks)
  • Clone usqlite into the pybricks-micropython source root folder
  • Build Pybricks for the EV3 target ev3dev-armel
  • Copy and test the build on a connected EV3 named ev3dev
cd bricks
git clone https://github.com/pybricks/pybricks-micropython
cd pybricks-micropython
git clone https://github.com/spatialdude/usqlite
make ev3dev-armel

If there were no build errors, copy the build to the EV3. The default EV3 password is maker.

scp bricks/ev3dev/pybricks-micropython robot@ev3dev:~

Test run the build.

ssh -t robot@ev3dev "brickrun -r -- ./pybricks-micropython"

Check if the usqlite module has been included.

import usqlite
help(usqlite)

If everything has worked correctly, you should see something like this -

Pybricks MicroPython v3.1.0c1-5-g35a969e9 on 2021-11-28; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import usqlite
>>> help(usqlite)
object <module 'usqlite'> is of type module
  __name__ -- usqlite
  __init__ -- <function>
  version -- 0.1.0
  version_info -- (0, 1, 0)
  sqlite_version -- 3.36.0
  sqlite_version_info -- (3, 36, 0)
  sqlite_version_number -- 3036000
  connect -- <function>
  complete_statement -- <function>
  mem_peak -- <function>
  mem_current -- <function>
  mem_status -- <function>
>>>
Clone this wiki locally