Expand description

This crate provides a lightweight wrapper around the rusb 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(())
}
Extending The blink(1) Device

The blink(1) device supports the control of additional lights by using three connections (ground, power, and data) exposed under the “diffuser” cap of the enclosure. A tutorial for adding a Neopixel strip can be found in this blog post.

To accomodate these setups, the Message kind carries an optional “index” -

use blinkrs::{Message,Color};
Message::Immediate(Color::from("red"), Some(10));

Structs

Wraps the rusb::Context type.

Enums

Represents a color mode that can be applied to the blink(1) LED light.

Represents a command processable by the specification outlined in the blink1 docs.