upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
API for the CJQ4435 MOSFET. More...
UPM module for the CJQ4435 MOSFET. It was developed using the Grove MOSFET module, but could be used with any MOSFET. A MOSFET is like a switch, but it can switch much faster than a mechanical relay. Here, we implement support via MRAA pulse width modulation (PWM) functions. Note: available periods vary depending on the capabilities of your platform.
Public Member Functions | |
CJQ4435 (int pin) | |
~CJQ4435 () | |
void | setPeriodUS (int us) |
void | setPeriodMS (int ms) |
void | setPeriodSeconds (float seconds) |
void | enable (bool enable) |
void | setDutyCycle (float dutyCycle) |
void | on () |
void | off () |
Protected Attributes | |
cjq4435_context | m_cjq4435 |
CJQ4435 | ( | int | pin | ) |
CJQ4435 constructor
pin | Digital pin to use; this pin must be PWM-capable |
void setPeriodUS | ( | int | us | ) |
Sets a period in microseconds
us | Period in microseconds |
void setPeriodMS | ( | int | ms | ) |
Sets a period in milliseconds
ms | Period in milliseconds |
void setPeriodSeconds | ( | float | seconds | ) |
Sets a period in seconds
seconds | Period in seconds |
void enable | ( | bool | enable | ) |
Enables output
enable | Enables PWM output if true, disables otherwise |
void setDutyCycle | ( | float | dutyCycle | ) |
Sets a duty cycle. Duty cycle is a floating-point number between 0.0 (always off) and 1.0 (always on). It represents a proportion of time, per period, during which the output is driven high.
dutyCycle | Duty cycle to use |
void on | ( | ) |
Shortcut to turn the output to continuous on (high)
void off | ( | ) |
Shortcut to turn the output to continuous off (low)