transition
About
This library allows you control the state of code execution using blink(1) LED notifier.
You simply wrap the code you want to track with transition library: ```rust use std::error::Error; use std::thread; use std::time::Duration; use transition::Transition;
fn main() -> Result<(), Box
// our example code
thread::sleep(Duration::from_secs(5));
// task finished with success
notification.notify_success()?;
Ok(())
} ```
start()
, blink(1) starts blinking with blue light. This is done in a separate
thread.notification.notify_success()
(or notification.notify_failure()
) which
changes the color of LED to green (or red).Supported colors: ```rust use transition::Led;
let color = Led::Blue; match color { Led::Red => println!("red"), Led::Green => println!("green"), Led::Blue => println!("blue"), Led::Yellow => println!("yellow"), Led::Orange => println!("orange"), Led::Pink => println!("pink"), Led::Cyan => println!("cyan"), Led::White => println!("white"), Led::Blank => println!("turn off the led"), }
```
Demo
Installation
Add as a dependency to your Cargo.toml
:
toml
[dependencies]
transition = "0.1.1"
One of the dependency requires libusb-1.0
to be installed. On Linux you can install it by running:
bash
sudo apt install libusb-1.0
Make sure that you have correct access rights to access blink(1) device. See udev rules here.
License
This project is licensed under either of
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.