5 releases

0.1.3 Feb 25, 2024
0.1.2 Feb 17, 2024
0.1.1 Feb 16, 2024
0.1.0 Feb 14, 2024
0.0.0 Jan 7, 2024

#743 in Hardware support

Download history 91/week @ 2024-02-09 309/week @ 2024-02-16 137/week @ 2024-02-23 23/week @ 2024-03-01 17/week @ 2024-03-08 8/week @ 2024-03-15

227 downloads per month

MPL-2.0 license

60KB
1.5K SLoC

rcx

Crates.io Version docs.rs GitHub Actions Workflow Status

Interface library for communicating with the LEGO Mindstorms RCX brick

Example

use rcx::{tower::usb::UsbTower, MotorSelection, Rcx};

const DEVICE: &str = "/dev/usb/legousbtower0";

fn main() -> color_eyre::Result<()> {
    color_eyre::install()?;
    let rcx = UsbTower::open(DEVICE)?;

    let mut rcx = Rcx::new(rcx);

    rcx.set_motor_direction(MotorSelection::A, rcx::MotorDirection::Forward)?;
    rcx.set_motor_power(MotorSelection::A, 5)?;
    rcx.set_motor_on_off(MotorSelection::A, rcx::MotorPowerState::On)?;
    std::thread::sleep(std::time::Duration::from_secs(2));
    rcx.set_motor_on_off(MotorSelection::A, rcx::MotorPowerState::Float)?;

    Ok(())
}

Dependencies

~1.6–3.5MB
~61K SLoC