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.LargeMotor('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.LargeMotor('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.2.post14.tar.gz (37.3 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.2.post14.tar.gz.

File metadata

File hashes

Hashes for python-ev3dev-0.2.2.post14.tar.gz
Algorithm Hash digest
SHA256 9ae0c5267a60febbebc82790bbe6b94e782d8b58b538c0f7f2a49de0d79b63ab
MD5 f358c54e311dc3299367a1bc48c2f7e0
BLAKE2b-256 a7175872cd5e048685c554e98ad04ae8f4d7911b367ffe2af26ecf98f67b24fb

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.2.post14-py3.4-linux-armv6l.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.2.post14-py3.4-linux-armv6l.egg
Algorithm Hash digest
SHA256 b190cb0ea206aeaabe935f1b35511590b98623e0c94f715d91120ab0acd101f1
MD5 a6056f324fa3acc1b2385c62f9d16646
BLAKE2b-256 5db9f44dbe9417a1485073f6e40a09670f3cf7625c21af4d8fd6c544270c93a8

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.2.post14-py3.4-linux-armv5tejl.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.2.post14-py3.4-linux-armv5tejl.egg
Algorithm Hash digest
SHA256 e7ea7b4685dae68c8af33160c58b723b8d552d7acc5d83e28df36bcfe00451b8
MD5 d75128407aa31c12e36563b5a31f2898
BLAKE2b-256 651085d8b697f960bf1145ba4f48e3f115aa547320a59d5f37b76da3eae5c4ac

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.2.post14-py2.7-linux-armv6l.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.2.post14-py2.7-linux-armv6l.egg
Algorithm Hash digest
SHA256 efe6160d936478d3c00b209dad25ca90abe8b306d261cb3449b509b2dd55fca2
MD5 7d8c05b257d8b4929470ad3e307b5de8
BLAKE2b-256 ca4df3684e83aaa69b6a8e836326f998c3c98a33963f607db9e8df7b344e6efb

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.2.post14-py2.7-linux-armv5tejl.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.2.post14-py2.7-linux-armv5tejl.egg
Algorithm Hash digest
SHA256 cb027c35cf6bc0414bb99385ea497e44978af989a8ef66f161a2f70d8edbae17
MD5 f466a6c7369f1216eb1f5002eba87eb6
BLAKE2b-256 b9492b116784192eee82d4a9607a5d0f069e8102f0413126fbc9f3f3a29cf22e

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