Class FanHelper
java.lang.Object
com.opensourcewithslu.outputdevices.FanHelper
Helper class to control a fan using PWM (Pulse Width Modulation).
-
Constructor Summary
ConstructorsConstructorDescriptionFanHelper(com.pi4j.io.pwm.Pwm fan) Constructor to initialize the FanHelper with a PWM instance. -
Method Summary
-
Constructor Details
-
FanHelper
public FanHelper(com.pi4j.io.pwm.Pwm fan) Constructor to initialize the FanHelper with a PWM instance.- Parameters:
fan- the PWM instance to control the fan
-
-
Method Details
-
start
public void start()Starts the fan at full speed (1024 duty cycle) for 10 seconds, then stops it. -
stop
public void stop()Stops the fan by turning off the PWM (0% duty cycle). -
setSpeed
public void setSpeed(int speed) Sets the fan speed by adjusting the PWM duty cycle.- Parameters:
speed- the desired fan speed (duty cycle). Must be between 0 and 1024.- Throws:
IllegalArgumentException- if the speed is out of bounds
-