use std::error::Error;
use std::thread;
use std::time::Duration;

use rppal::pwm::{Channel, Polarity, Pwm};

fn main() -> Result<(), Box<dyn Error>> {
    let pwm = Pwm::with_frequency(Channel::Pwm0, 2.0, 0.25, Polarity::Normal, true)?;
    thread::sleep(Duration::from_secs(2));

    pwm.set_frequency(8.0, 0.5)?;
    thread::sleep(Duration::from_secs(3));

    Ok(())
}
