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 https://github.com/ddemidov/ev3dev-lang-python.

.. _ev3dev: http://ev3dev.org

Installation
------------

* 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
version.

Usage
-----

Take a look at the provided demos_. The autogenerated reference
documentation is hosted at http://ddemidov.github.io/ev3dev-lang-python.

.. _demos: https://github.com/ddemidov/ev3dev-lang-python/tree/master/demo

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
True
>>> 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 `rpyc_classic.py` command on the
EV3, you can connect to the server from your main computer:

.. code-block:: python

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

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
remotely:

.. code-block:: python

>>> ev3dev = c.modules.ev3dev
>>> m = ev3dev.large_motor('outA')
>>> m.connected
True
>>> 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: http://ipython.org
.. _access the notebook server: https://coderwall.com/p/ohk6cg/remote-access-to-ipython-notebooks-via-ssh
.. _nice post: http://robotsquare.com/2014/06/12/linux-ev3/
.. _RPyC: https://rpyc.readthedocs.org/en/latest/

Project details


Download files

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

Source Distribution

python-ev3dev-0.2.1.post17.tar.gz (36.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file python-ev3dev-0.2.1.post17.tar.gz.

File metadata

File hashes

Hashes for python-ev3dev-0.2.1.post17.tar.gz
Algorithm Hash digest
SHA256 f6e9d30686059f57b2a8cb8e3ba07bc2519580c32c7e025acd75f2ac1bd9e0ea
MD5 beff5e0043b769803b2974dff5ab95e3
BLAKE2b-256 59c5d984b12816c9d3381d18b95b9aa1a9ca47cd459cd84dabca026a27ad81b3

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.1.post17-py3.4-linux-armv6l.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post17-py3.4-linux-armv6l.egg
Algorithm Hash digest
SHA256 d75cfa5f1d4ee83e3476b593663fb66ccedaaa9faf6308d95dba467a8be3fca0
MD5 4f03efec6585b7c073178b3f19cdaa2e
BLAKE2b-256 cdfcf35fcd49c3eb0db7c29246b2b8d6284e72d18a60004d0429964a9b53e35e

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.1.post17-py3.4-linux-armv5tejl.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post17-py3.4-linux-armv5tejl.egg
Algorithm Hash digest
SHA256 01c01c46c387be67e5ed921ffc0fe9189d759c78852ed49c97f112830ee54258
MD5 be69b1c8f5aebcba55d057f1593984fa
BLAKE2b-256 cc53d697ca5d3056a0fe5c167db00ed16e3183b670869072293e6c9dc6ad0762

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.1.post17-py2.7-linux-armv6l.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post17-py2.7-linux-armv6l.egg
Algorithm Hash digest
SHA256 aedceb95da5bcc9003b96030844183cca3d4130624ccadd77b056341be1b572c
MD5 41259e418fbb6a84bfd1c392b6718360
BLAKE2b-256 58776f5e396223cff3dfc2b0272a7ca4b7340935c2a2b9ed2d7c98db966c6027

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.1.post17-py2.7-linux-armv5tejl.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post17-py2.7-linux-armv5tejl.egg
Algorithm Hash digest
SHA256 6e055294f809741a3a9c35fd190f34c428f96c01002c11747c72646ffaa93eea
MD5 e2b1acce327a013eed8f47a5d648a6c7
BLAKE2b-256 3e74abe47f8f05a07e28ac7c6a8c566975f0e756cc664c731101cf7fb6c50e52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page