20 releases

Uses old Rust 2015

new 0.10.2 Apr 26, 2021
0.10.1 Mar 20, 2021
0.10.0 Feb 2, 2021
0.9.6 Dec 23, 2020
0.4.0 Sep 30, 2018

#31 in Hardware support

Download history 23/week @ 2021-01-09 367/week @ 2021-01-16 32/week @ 2021-01-23 43/week @ 2021-01-30 39/week @ 2021-02-06 118/week @ 2021-02-13 79/week @ 2021-02-20 29/week @ 2021-02-27 16/week @ 2021-03-06 14/week @ 2021-03-13 69/week @ 2021-03-20 49/week @ 2021-03-27 30/week @ 2021-04-03 38/week @ 2021-04-10 66/week @ 2021-04-17 25/week @ 2021-04-24

200 downloads per month

MIT license


Rust language bindings for ev3dev

Build Latest version


Currently this project is not compatible with the BrickPi platform.


extern crate ev3dev_lang_rust;

use ev3dev_lang_rust::Ev3Result;
use ev3dev_lang_rust::motors::{LargeMotor, MotorPort};
use ev3dev_lang_rust::sensors::ColorSensor;

fn main() -> Ev3Result<()> {

    // Get large motor on port outA.
    let large_motor = LargeMotor::get(MotorPort::OutA)?;

    // Set command "run-direct".

    // Run motor.

    // Find color sensor. Always returns the first recognised one.
    let color_sensor = ColorSensor::find()?;

    // Switch to rgb mode.

    // Get current rgb color tuple.
    println!("Current rgb color: {:?}", color_sensor.get_rgb()?);


Cross compilation for the ev3 robot

  1. Create target configuration in .cargo/config

    linker = "/usr/bin/arm-linux-gnueabi-gcc"
  2. Get the docker image. You can either download the prebuild image or build it yourself with the provided Dockerfile (docker/Dockerfile).

    docker pull pixix4/ev3dev-rust
    # or
    docker build . -t pixix4/ev3dev-rust --no-cache
  3. Build binary

    # Run in interactive docker shell
    docker run -it --rm -v $PWD:/build/ -w /build pixix4/ev3dev-rust
    cargo build --release --target armv5te-unknown-linux-gnueabi
    # Run directly (e.g. via Makefile)
    docker run --rm -v $PWD:/build/ -w /build pixix4/ev3dev-rust \
            cargo build --release --target armv5te-unknown-linux-gnueabi

    The --release flag is optional. However, it can speed up the execution time by a factor of 30.

    The target binary is now in target/armv5te-unknown-linux-gnueabi/release/{application_name}

    If you use the direct method you will notice that each build gets stuck at Updating crates.io index for a long time. To speed up this step you can use the vendoring machanic of cargo.

    cargo vendor

    Execute the above command and add this addtional config to .cargo/config.

    replace-with = "vendored-sources"
    directory = "vendor"

Editor support

If you have problems with code completion or inline documentation with rust analyzer it may help to enable to following settings:

    "rust-analyzer.cargo.loadOutDirsFromCheck": true,
    "rust-analyzer.procMacro.enable": true,

(Example from VSCode settings.json)


~29K SLoC