Control DC fan motors with PWM along with a minimum PWM duty before turning on.
DcFan Class Reference
Interface to control a 2 pin DC fan. More...
#include <DcFan.h>
Public Member Functions | |
| DcFan (PinName pwm, float min_active_pwm) | |
| Create a fan motor control interface. | |
| void | speed (float speed) |
| Set the speed of the motor. | |
| float | current_speed (void) |
| Get the set speed of the motor, does *not* read RPMs from fan. | |
Detailed Description
Interface to control a 2 pin DC fan.
Set speed with PWM. No rpm readings
Drive a fan using a PwmOut Example:
//Initialize and control a TEC connected to an H-bridge #include "mbed.h" #include "DcFan.h" DcFan myFan(p26, 0.5); // pwm, minimum pwm speed int main() { double fanSpeed = 0.0; while(1) { if (fanSpeed < 1.0) { fanSpeed += 0.1; } // fans won't turn on until fanSpeed >= 0.5 Fans.speed(fanSpeed); wait(1.0); } }
Definition at line 56 of file DcFan.h.
Constructor & Destructor Documentation
| DcFan | ( | PinName | pwm, |
| float | min_active_pwm | ||
| ) |
Member Function Documentation
| float current_speed | ( | void | ) |
Get the set speed of the motor, does *not* read RPMs from fan.
Generated on Wed Jul 20 2022 07:13:24 by
1.7.2