8000 GitHub - golemparts/blinkt at 0.1.2
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A Rust library for the Pimoroni Blinkt!, and any similar APA102 or SK9822 LED strips or boards, on a Raspberry Pi.

License

Notifications You must be signed in to change notification settings

golemparts/blinkt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blinkt

Build Status crates.io MIT licensed

Blinkt is a Rust library that provides an interface for the Pimoroni Blinkt!, and any similar APA102 or SK9822 strips or boards, on a Raspberry Pi.

Blinkt accesses the BCM283x GPIO peripheral either through /dev/gpiomem (preferred) or /dev/mem. Both the original APA102 and the SK9822 clone are supported. The APA102 RGB LED/driver ICs are referred to as pixels throughout the code and documentation.

Documentation

All documentation can be found at doc.golemparts.com/blinkt.

Usage

Add a dependency for blinkt to your Cargo.toml.

[dependencies]
blinkt = "0.1"

Link and import blinkt from your crate root.

extern crate blinkt;

Call Blinkt::new() to create a new Blinkt with the default settings. In production code, you'll want to parse the result rather than unwrap it.

use blinkt::Blinkt;

let mut blinkt = Blinkt::new().unwrap();

Example

extern crate blinkt;

use std::{thread, mem};
use std::time::Duration;

use blinkt::Blinkt;

fn main() {
    let mut blinkt = Blinkt::new().unwrap();
    let (red, green, blue) = (&mut 255, &mut 0, &mut 0);

    loop {
        blinkt.set_all_pixels(*red, *green, *blue);
        blinkt.show();

        thread::sleep(Duration::from_millis(250));

        mem::swap(red, green);
        mem::swap(red, blue);
    }
}

Copyright and license

Copyright (c) 2016-2017 Rene van der Meer. Released under the MIT license.

About

A Rust library for the Pimoroni Blinkt!, and any similar APA102 or SK9822 LED strips or boards, on a Raspberry Pi.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages

0