Skip to main content

Python language bindings for ev3dev

Project description

Python language bindings for ev3dev

This is a python library implementing unified interface for ev3dev_ devices.
The source code is hosted at

.. _ev3dev:


* Prerequisites:

.. code-block:: bash

apt-get install libboost-python1.55.0 python-setuptools python-pil

These should be enough to install and use the library on your ev3. If you want
to install it on your main computer (for example, to let your IDE of choice
know about the library), or compile the library from source, you will also need
to install `libboost-python1.55-dev`.

* Now, the actual module installation:

.. code-block:: bash

easy_install -U python-ev3dev

Same command will upgrade already installed package to the latest available


Take a look at the provided demos_. The autogenerated reference
documentation is hosted at

.. _demos:

Here is a simple example of running a large EV3 motor connected to output port
`A` for three seconds:

.. code-block:: python

>>> import ev3dev
>>> m = ev3dev.large_motor('outA')
>>> m.connected
>>> m.run_timed(time_sp=3000, duty_cycle_sp=75)

Remote operation

.. highlight:: bash

There are a couple of options for running python code remotely on the EV3
(aside from obvious choice of doing everything in ssh session).

First, you can install `IPython Notebook`_ with:

.. code-block:: bash

apt-get install ipython-notebook

and `access the notebook server`_ from your main computer. There is a `nice
post`_ by Laurens Valk showing this in action. Unfortunately, the IPython
process seems to be rather heavy for the limited EV3 resources, and the
experience tends to deteriorate with time.

The second option is using RPyC_ (Remote Python Call) library. It may be
installed with:

.. code-block:: bash

pip install rpyc

You need to install it both on the EV3 and on the remote host.
After that, once you launch RPyC server with `` command on the
EV3, you can connect to the server from your main computer:

.. code-block:: python

>>> import rpyc
>>> c = rpyc.classic.connect("")

The parameter to `connect()` function is the host name or the ip address of the
EV3. After the connection is made, you can import the `ev3dev` module

.. code-block:: python

>>> ev3dev = c.modules.ev3dev
>>> m = ev3dev.large_motor('outA')
>>> m.connected
>>> m.run_timed(time_sp=3000, duty_cycle_sp=75)

Note that the code is the same as in the example above once you connect to
remote RPyC server, although its run from a different machine. This may be used
either for interactive developing, or to run resource-heavy programs.

.. _IPython Notebook:
.. _access the notebook server:
.. _nice post:
.. _RPyC:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
python_ev3dev-0.2.2.post10-py2.7-linux-armv5tejl.egg (1.5 MB) Copy SHA256 hash SHA256 Egg 2.7
python_ev3dev-0.2.2.post10-py2.7-linux-armv6l.egg (1.5 MB) Copy SHA256 hash SHA256 Egg 2.7
python_ev3dev-0.2.2.post10-py3.4-linux-armv5tejl.egg (1.5 MB) Copy SHA256 hash SHA256 Egg 3.4
python_ev3dev-0.2.2.post10-py3.4-linux-armv6l.egg (1.4 MB) Copy SHA256 hash SHA256 Egg 3.4
python-ev3dev-0.2.2.post10.tar.gz (37.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page