25 lines
482 B
Rust
25 lines
482 B
Rust
use std::thread;
|
|
use std::time::Duration;
|
|
|
|
use rppal::gpio::Gpio;
|
|
|
|
let gpio = Gpio::new()?;
|
|
let mut fanFiveVoltRail = gpio.get(2)?.into_output();
|
|
|
|
// Quick toggle fans 5 seconds long, 0.5s interval
|
|
|
|
let mut i = 0;
|
|
|
|
while i < 11 {
|
|
fanFiveVoltRail.set_high();
|
|
thread::sleep(Duration::from_secs(0.5));
|
|
fanFiveVoltRail.set_low();
|
|
i = i + 1
|
|
}
|
|
|
|
// Run fans for five more seconds constant
|
|
|
|
fanFiveVoltRail.set_high();
|
|
thread::sleep(Duration::from_secs(5));
|
|
fanFiveVoltRail.set_low();
|