Rust library for interacting with the Pimoroni Unicorn HAT HD. This is a fork that builds on stable Rust and updates dependencies.
The docs can be found online at docs.rs, or be built using cargo doc
.
Add unicorn_hat_hd_2
to your Cargo.toml
.
toml
[dependencies]
unicorn_hat_hd_2 = "0.3"
Add unicorn_hat_hd_2
to your crate root.
rust
extern crate unicorn_hat_hd_2;
Create a default UnicornHatHd
, and start setting some pixels.
```rust use unicornhathd::UnicornHatHd;
pub fn main() { let mut hathd = UnicornHatHd::default(); loop { for y in 0..16 { for x in 0..16 { hathd.setpixel(x, y, [255, 255, 255].into()); hathd.display().unwrap(); hathd.setpixel(x, y, [0, 0, 0].into()); } } } } ```
In order to help make development of apps that use the library a little faster/easier/less-painful, you can turn on emulation of the physical display, so that it can compile on platforms other than Linux & the Raspberry PI.
In the Cargo.toml
:
toml
[dependencies.unicorn_hat_hd_2]
version = "*"
default-features = false
features = ["fake-hardware"]
Though, you should replace the version = "*"
with an actual version
constraint.
Copyright (c) 2017 Jacob Helwig. Released under the BSD license.