diff --git a/src/moduleTests/fanTest.rs b/src/moduleTests/fanTest.rs new file mode 100644 index 0000000..8c41ab2 --- /dev/null +++ b/src/moduleTests/fanTest.rs @@ -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();