-
-
Save enricostano/9334fdbe540a0a483a1314b1a42b4280 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate sysfs_gpio; | |
use sysfs_gpio::{Direction,Pin}; | |
use std::time::Duration; | |
use std::thread::sleep; | |
fn main() { | |
let led = Pin::new(16); | |
led.with_exported(|| { | |
sleep(Duration::from_millis(1000)); | |
try!(led.set_direction(Direction::Low)); | |
for _ in 0..10 { | |
println!("GO!"); | |
try!(led.set_value(0)); | |
sleep(Duration::from_millis(1000)); | |
try!(led.set_value(1)); | |
sleep(Duration::from_millis(1000)); | |
} | |
led.set_value(0) | |
}).unwrap(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
udev rule: