extern crate rustberry;
use std::env::args;
use std::thread;
use std::time::Duration;
use rustberry::peripherals::{Peripherals, PwmConfig};
fn main() {
let pin = args().nth(1)
.map(|s| s.parse().unwrap())
.unwrap_or(18);
let peripherals = Peripherals::new().unwrap();
let mut pin = peripherals.get_pwm_output(pin, PwmConfig::default())
.unwrap();
pin.set_range(100);
loop {
for i in 0..100 {
pin.set_value(i);
thread::sleep(Duration::from_millis(10));
}
for i in (0..100).rev() {
pin.set_value(i);
thread::sleep(Duration::from_millis(10));
}
}
}