Skip to content
LEGO MINDSTORMS EV3 Debian C library + Python, Ruby and Perl wrappers
Branch: master
Clone or download
Latest commit 4b8b497 Jan 28, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
3d_party 0.3b5 Sep 19, 2014
asm fixed hex int format for asm files Jun 16, 2018
doc updated docs Oct 21, 2017
docker updated yupp Jan 20, 2019
eg updated yupp Jan 20, 2019
lib
object/mingw 0.3b5 Sep 19, 2014
perl updated examples May 17, 2016
project updated Makefile Nov 28, 2017
python updated Python package Oct 15, 2017
ruby updated examples May 17, 2016
source/ev3 1.0c3 Jan 27, 2019
yupp @ 26f5a67 updated yupp Jan 20, 2019
.gitattributes 0.3b4 Sep 18, 2014
.gitignore fixed makefiles Aug 26, 2016
.gitmodules added yupp submodule Jun 16, 2016
LICENSE 0.9b6 (4.4.44-18-ev3dev-ev3) Feb 8, 2017
README 1.0c3 Jan 27, 2019
README.md updated README Jan 27, 2019
ev3.yu-i updated SWIG interface file Sep 20, 2017
tools.py improved clip_h Jun 16, 2016

README.md

logo

VERSION

ev3dev-c    1.0c3
            2019-01-27

kernel      4.4.87-22-ev3dev-ev3

WHAT IS IT?

ev3dev-c is a C library for LEGO MINDSTORMS EV3 Debian Linux which wraps access to the EV3 hardware.

The library also supports remote access to the EV3 brick over a network. So, if you configure WLAN on the brick, you can control the EV3 hardware from a remote computer, for example, running under Windows.

GETTING STARTED

Before you start, make sure that you have opened an SSH connection to your EV3 brick.

You need to install the compiler and other tools:

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install git

Then, clone the library repository and its submodules to the directory of your choice, such as "/home/robot/ev3dev-c":

cd /home/robot/
git clone https://github.com/in4lio/ev3dev-c.git
cd ev3dev-c/
git submodule update --init --recursive

Compile and install static and shared libraries:

cd source/ev3/
make
sudo make install
make shared
sudo make shared-install

It's the right time to take a look at a small example. "hello.c" outputs a greeting as well as toggles the left LED color:

cd ../../eg/hello/
more ./hello.c

Let's compile and run this program. Note that we link our example with a static library:

gcc hello.c -lev3dev-c -o hello
./hello

See also – "Getting Started with C"

PYTHON, RUBY and PERL

Python, Ruby and Perl libraries are automatically generated from the C library using SWIG tool.

Use pip to install ev3dev-c Python package:

pip install ev3dev-c

ev3dev-c Python package contains the following binary modules:

  • "_ev3.pyd" – for remote control from Windows (x86)
  • "_ev3.so" – for LEGO MINDSTORMS EV3 Debian

You have to install "python-dev", "ruby-dev" and "libperl-dev" packages to build the corresponding libraries.

GET HELP

Documentation generated by Doxygen

FAQ

What are unusual ".yu", ".yu-с" and ".yu-h" files for?

ev3dev-c is written using yupp lexical preprocessor – but don't panic – the generated source files in C also included.

You have to take into account that, by default, the preprocessing stage is skipping when compilation is performed on the brick or using Docker. Please set SKIP_PP = 0 in the makefile to allow preprocessing anywhere.

How can I see some examples

Name Description
drive.c Comprehensive example based on coroutines
remote.c IR remote control using "brick" simplified library
remote.py Use of "brick" library in Python
port.c Use of EV3 ports
sensor.c TOUCH and COLOR sensors example
tacho.c TACHO motor running for 5 sec
dc.c Use of a DC motor
servo.c SERVO motor example
light.c LEDs blinking example
rcx_led.c Use of a RCX LED

Further examples in C...

Similar examples also available in Python, Ruby and Perl.

How to make an example

For instance, to compile "light.c" example:

cd ev3dev-c/eg/light/
make

./Debug/light

or, if you are running Windows:

.\Debug\mingw\light.exe

How to control the EV3 hardware remotely

Read here...

How to use Docker for Cross-Compilation

Read here...

How to make and install STATIC library

cd ev3dev-c/source/ev3/
make
sudo make install

How to make and install SHARED library

cd ev3dev-c/source/ev3/
make shared
sudo make shared-install

How to use SHARED library

cd ev3dev-c/eg/port/
gcc port.c -lev3dev-c -o port

./port

GIT

Run the following on your command-line to clone the library repository and its submodules:

git clone https://github.com/in4lio/ev3dev-c.git
cd ev3dev-c/
git submodule update --init --recursive

Pull the latest library and its submodules:

cd ev3dev-c/
git pull origin master
git submodule foreach git pull origin master

CONTACT

Please feel free to contact me at in4lio+ev3@gmail.com if you have any questions about this library.

LICENSE

Please see the file called "LICENSE".

You can’t perform that action at this time.