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.post18.tar.gz (36.8 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.post18.tar.gz.

File metadata

File hashes

Hashes for python-ev3dev-0.2.1.post18.tar.gz
Algorithm Hash digest
SHA256 bd8c36ed89ea1b6592c36c989a550cbecc03561af18fd1fd3c73faf8f23f9b8f
MD5 b507e40176613389b2402735799ecc56
BLAKE2b-256 8a670bd224c624b7c77c7a9aaefbf0c4c5e7871bfe2dade9a8ed41461d3b6b86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post18-py3.4-linux-armv6l.egg
Algorithm Hash digest
SHA256 2020949cf565436ba9fca3ae405593121104bfe64b3cc4aaadd117f1763efe7d
MD5 4ced8801c392d071dccfe5e3920e0b51
BLAKE2b-256 6cc2e05c2d14b3dc5b67ce748a5fe0d24d1688d1cf01250ae9e6fc7efda7b7c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post18-py3.4-linux-armv5tejl.egg
Algorithm Hash digest
SHA256 337f9bb86b51e9104c859d1d07804fbba70a07d33f5348dedcc266f483e80ad0
MD5 1ab5a1949b7c838bcc392030b95832be
BLAKE2b-256 7b9f5c350784bb72671950f743509dc64990e9f2a0d859361f6050c3f9645c25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post18-py2.7-linux-armv6l.egg
Algorithm Hash digest
SHA256 7b50cde5c5785623290f22f0cde4c70fbe6628362ecd2d2528a636ade75fc2ae
MD5 419e3b40c9b29197f645adf3df8bf26a
BLAKE2b-256 1922bc39507646a5b8508e8acdbeb557f21562ffabdd6bfecf7b33a485ff9417

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post18-py2.7-linux-armv5tejl.egg
Algorithm Hash digest
SHA256 72b2f5e0fca46b50a503e26456640a24cdafe3443529e0cecfcece6fc3be5e84
MD5 43ca387161b7d357a89d7d843246ed08
BLAKE2b-256 321eeecf77ea2fbc9254cc7dfc3e8f3e5a9e9b0483aab21d311c0f135a40c27f

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