Add fan test module
This commit is contained in:
24
src/moduleTests/fanTest.rs
Normal file
24
src/moduleTests/fanTest.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
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();
|
||||
Reference in New Issue
Block a user