#blink #blink-1

bin+lib blinkrs

A small api for interacting with blink(1) LED lights

4 releases (1 stable)

✓ Uses Rust 2018 edition

1.0.0 Jan 17, 2020
0.2.1 Oct 9, 2019
0.2.0 Oct 2, 2019
0.1.0 Sep 27, 2019

35 downloads per month

MIT license

12KB
266 lines

blink(rs)

ci.img docs.img

A rust cli tool for controlling the blink(1) USB LED light.

Example

use std::boxed::Box;
use std::error::Error;

use blinkrs::{Blinkers, Message};

fn main() -> Result<(), Box<dyn Error>> {
    let blinkers: Blinkers = match Blinkers::new() {
        Ok(b) => b,
        Err(_e) => {
            println!("unable to find device");
            return Ok(())
        },
    };
    blinkers.send(Message::from("red"))?;
    blinkers.send(Message::from("off"))?;
    Ok(())
}

Contributing

See CONTRIBUTING.


lib.rs:

This crate provides a lightweight wrapper around the libusb crate specifically targeting the API of a blink(1) usb device.

Example

use std::boxed::Box;
use std::error::Error;

use blinkrs::{Blinkers, Message};

fn main() -> Result<(), Box<dyn Error>> {
    let blinkers: Blinkers = match Blinkers::new() {
        Ok(b) => b,
        Err(_e) => {
            println!("unable to find device");
            return Ok(())
        },
    };
    blinkers.send(Message::from("red"))?;
    blinkers.send(Message::from("off"))?;
    Ok(())
}

Dependencies

~320KB