Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PwmOut Class Reference
The PwmOut interface is used to control the frequency and mark-space ratio of a digital pulse train. More...
#include <PwmOut.h>
Inherits CPPToPigpio::CPPToPigpio.
Public Member Functions | |
PwmOut (PinName pin) | |
Create a PwmOut connected to the specified pin. | |
PwmOut (PinName pin, float val) | |
Create a PwmOut connected to the specified pin. | |
PwmOut (int pin) | |
Create a PwmOut connected to the specified pin. | |
PwmOut (int pin, float val) | |
Create a PwmOut connected to the specified pin. | |
void | write (float val) |
Set the ouput duty-cycle, specified as a percentage (float) | |
float | read () |
Return the current output duty-cycle setting, measured as a percentage (float) | |
float | period (float seconds) |
Set the PWM period, specified in seconds (float), keeping the duty cycle the same. | |
float | period_ms (int ms) |
Set the PWM period, specified in miliseconds (int), keeping the duty cycle the same. | |
float | period_us (int us) |
Set the PWM period, specified in microseconds (int), keeping the duty cycle the same. | |
PwmOut & | operator= (float val) |
A operator shorthand for write() | |
PwmOut & | operator= (PwmOut &) |
A operator shorthand for write() | |
operator float () | |
An operator shorthand for read() | |
~PwmOut () | |
Deconstructor. |
Detailed Description
The PwmOut interface is used to control the frequency and mark-space ratio of a digital pulse train.
Definition at line 7 of file PwmOut.h.
Constructor & Destructor Documentation
PwmOut | ( | PinName | pin ) |
PwmOut | ( | PinName | pin, |
float | val | ||
) |
Create a PwmOut connected to the specified pin.
- Parameters:
-
pin PwmOut pin to connect to value A floating-point value representing the output duty-cycle, specified as a percentage. The value should lie between 0.0f (representing on 0%) and 1.0f (representing on 100%). Values outside this range will be saturated to 0.0f or 1.0f.
PwmOut | ( | int | pin ) |
PwmOut | ( | int | pin, |
float | val | ||
) |
Create a PwmOut connected to the specified pin.
- Parameters:
-
pin PwmOut pin to connect to value A floating-point value representing the output duty-cycle, specified as a percentage. The value should lie between 0.0f (representing on 0%) and 1.0f (representing on 100%). Values outside this range will be saturated to 0.0f or 1.0f.
Member Function Documentation
operator float | ( | ) |
PwmOut & operator= | ( | float | val ) |
float period | ( | float | seconds ) |
float period_ms | ( | int | ms ) |
float period_us | ( | int | us ) |
float read | ( | ) |
Return the current output duty-cycle setting, measured as a percentage (float)
- Returns:
- A floating-point value representing the current duty-cycle being output on the pin, measured as a percentage. The returned value will lie between 0.0f (representing on 0%) and 1.0f (representing on 100%).
void write | ( | float | val ) |
Set the ouput duty-cycle, specified as a percentage (float)
- Parameters:
-
value A floating-point value representing the output duty-cycle, specified as a percentage. The value should lie between 0.0f (representing on 0%) and 1.0f (representing on 100%). Values outside this range will be saturated to 0.0f or 1.0f.
Generated on Tue Jul 12 2022 14:39:23 by
