#blink #blink-1

bin+lib blinkrs

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

3 unstable releases

✓ Uses Rust 2018 edition

new 0.2.1 Oct 9, 2019
0.2.0 Oct 2, 2019
0.1.0 Sep 27, 2019

MIT license

13KB
268 lines

blink(rs)

travis.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

~310KB