Giter Club home page Giter Club logo

python-ev3's Introduction

python-ev3

Program Lego Mindstorms EV3 using Python on ev3dev

What you need

You need a working ev3dev on your ev3 and have an ssh session. Please reference the ev3dev site to burn such system.
Current python-ev3 is developed on ev3-ev3dev-jessie-2015-05-20

Both python 2.7 and python 3.4 are supported

python-ev3 is tested on the ev3-dev in python2.7 and python3.4. I have no all lego devices, so if there's something wrong or not working, please file an issue or create a pull request. I'm quite happy to receive more devices code.

virtualenv

Current python-ev3 is not stable enough, virtualenv is recommend. Below examples are in virtualenv. However, python-ev3 should work in a native python environment.

Install the python-ev3 on EV3

Python 2.7

  • apt-get update
  • apt-get install virtualenv virtualenvwrapper python-setuptools python-smbus python-pil
  • source /etc/bash_completion.d/virtualenvwrapper
  • mkvirtualenv ev3_py27 --python=/usr/bin/python2.7 --system-site-packages
  • workon ev3_py27
  • easy_install -U python-ev3
  • type deactive to exit

Python 3.4

  • apt-get update
  • apt-get install virtualenv virtualenvwrapper python3-setuptools python3-smbus python3-pil
  • source /etc/bash_completion.d/virtualenvwrapper
  • mkvirtualenv ev3_py34 --python=/usr/bin/python3.4 --system-site-packages
  • workon ev3_py34
  • easy_install -U python-ev3
  • type deactive to exit

Example

(ev3_py27)root@ev3dev:~# python
Python 2.7.8 (default, Jul  4 2014, 16:59:40)
[GCC 4.9.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ev3.lego import MediumMotor
>>> d = MediumMotor()
>>> d.reset()
>>> d.run_forever(50, regulation_mode=False)
>>> d.stop()
>>> exit()

To exit the virtual env, type deactivate

More devices

Plese see test to know how to use other devices.
To create new sensor class please see How to create a new sensor class

Python3 vs Python2 performance

@fuzzycow found there's some performance problem when using Python3. Please see topikachu#22

Reference

python-ev3's People

Contributors

aleh-arol avatar bastian-kuhn avatar dwalton76 avatar gregory-m avatar hmml avatar jesper-friis avatar johnwason avatar linagkar avatar maxnoe avatar mimoralea avatar mincrmatt12 avatar pepijndevos avatar schoolsplay avatar szabolcszijarto avatar topikachu avatar youtalk avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.