rcx 0.1.3

Communicate with LEGO RCX bricks
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use rcx::{tower::usb::UsbTower, Rcx, SensorType, SourceType};

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_sensor_type(0, SensorType::Light)?;

    loop {
        let data = rcx.get_value(SourceType::SensorValue, 0);
        let _ = dbg!(data);
        std::thread::sleep(std::time::Duration::from_secs(1));
    }
}