From f1a018ce356a02eea5be4bcdf3f468f5e99924b5 Mon Sep 17 00:00:00 2001 From: Noa Fabbricotti Date: Thu, 26 Mar 2026 10:37:34 +0100 Subject: [PATCH] Add fan test module --- src/moduleTests/fanTest.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/moduleTests/fanTest.rs 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();