Treehopper C# API
|
This provides a generic interface to PWM operation. More...
Public Member Functions | |
Task | EnablePwmAsync () |
Enable the PWM functionality More... | |
Task | DisablePwmAsync () |
Disables the PWM functionality More... | |
Properties | |
double | DutyCycle [get, set] |
Get or set the duty cycle (0-1) of the pin More... | |
double | PulseWidth [get, set] |
Get or set the pulse width, in microseconds, of the pin More... | |
This provides a generic interface to PWM operation.
Since both the SoftPwm and HardwarePwm classes implement this interface, it is useful for applications that are agnostic to differing resolutions or amount of jitter, and only need basic DutyCycle or PulseWidth control.
Since HardwarePwm and SoftPwm have different periods (and different ways of setting the period), period control is not available in this interface. However, HardwarePwm initializes to a period of approximately 780 Hz and SoftPwm initializes with a period of approximately 100 Hz. These values are suitable for LED dimming, motor control, and other common applications. If higher (or lower) frequencies are desired, your library should use HardwarePwm or SoftPwm directly.
Task EnablePwmAsync | ( | ) |
Enable the PWM functionality
///
Implemented in Pin, Pin, Pca9632.Pin, and HardwarePwm.
Task DisablePwmAsync | ( | ) |
Disables the PWM functionality
Implemented in Pin, Pin, Pca9632.Pin, and HardwarePwm.
|
getset |
Get or set the duty cycle (0-1) of the pin
|
getset |
Get or set the pulse width, in microseconds, of the pin