[−][src]Crate ev3dev_lang_rust
Rust language bindings for ev3dev
extern crate ev3dev_lang_rust; use ev3dev_lang_rust::prelude::*; 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". large_motor.run_direct()?; // Run motor. large_motor.set_duty_cycle_sp(50)?; // Find color sensor. Always returns the first recognised one. let color_sensor = ColorSensor::find()?; // Switch to rgb mode. color_sensor.set_mode_rgb_raw()?; // Get current rgb color tuple. println!("Current rgb color: {:?}", color_sensor.get_rgb()?); Ok(()) }
Re-exports
pub use led::Led; |
Modules
| led | The leds on top of the EV3 brick. |
| motors | Container module for motor types |
| prelude | The purpose of this module is to alleviate imports of many common ev3dev traits. |
| sensors | Container module for sensor types |
| sound | Sound-related functions. It can beep, play wav files, or convert text to speech. |
| wait | Utility functions for cpu efficent |
Structs
| Attribute | A wrapper to a attribute file in the |
| Driver | Helper struct that manages attributes.
It creates an |
| Ev3Button | Ev3 brick button handler. Opens the corresponding |
| PowerSupply | An interface to read data from the system’s power_supply class. Uses the built-in legoev3-battery if none is specified. |
Enums
| Ev3Error | Custom error type for internal errors. |
Traits
| Device | The ev3dev device base trait |
| Findable | Helper trait to create a new |
| Port | EV3 ports |
Type Definitions
| Ev3Result | Helper |