Crate rust_gpiozero [] [src]

A simple interface to GPIO devices with Raspberry Pi.

This library is based on GPIOZero library.

Note: This is a work in progress. The library will eventually support embedded-hal based drivers

The idea is to get started with physical computing using Rust with little coding by hiding the underlying complexity.

The library uses BCM Pin numbering

Example : Blinking an LED


extern crate rust_gpiozero;
use rust_gpiozero::*;

fn main() {

// Create a new LED attached to Pin 17

let mut led = LED::new(17);

// blink the LED
// on_time: 2 seconds and off_time: 3 seconds

led.blink(2,3);

}

Example : Wait for a Button Press


extern crate rust_gpiozero;
use rust_gpiozero::*;

fn main() {
let button = Button::new(17);
button.wait_for_press();
println!("button pressed");

}

Re-exports

pub use self::output_devices::*;
pub use self::devices::*;
pub use self::traits::*;
pub use self::input_devices::*;

Modules

devices

Describes generic devices such as GPIODevice and CompositeDevice

input_devices

Input device component interfaces for devices such as Button

output_devices

Output device component interfaces for devices such as LED

traits

Adds important functionalities