This file defines the PWM interface for libmraa
if (pwm == NULL) {
}
fprintf(stdout, "Cycling PWM on IO3 (pwm3) \n");
float value = 0.0f;
while (running == 0) {
value = value + 0.01f;
usleep(50000);
if (value >= 1.0f) {
value = 0.0f;
}
}
delete pwm;
Pwm |
( |
int |
pin, |
|
|
bool |
owner = true , |
|
|
int |
chipid = -1 |
|
) |
| |
|
inline |
instanciates a PWM object on a pin
- Parameters
-
pin | the pin number used on your board |
owner | if you are the owner of the pin the destructor will |
chipid | the pwmchip to use, use only in raw mode unexport the pin from sysfs, default behaviour is you are the owner if the pinmapper exported it |
Set the output duty-cycle percentage, as a float
- Parameters
-
percentage | A floating-point value representing percentage of output. The value should lie between 0.0f (representing on 0%) and 1.0f Values above or below this range will be set at either 0.0f or 1.0f |
- Returns
- Result of operation
Read the ouput duty-cycle percentage, as a float
- Returns
- A floating-point value representing percentage of output. The value should lie between 0.0f (representing on 0%) and 1.0f Values above or below this range will be set at either 0.0f or 1.0f
Set the PWM period as seconds represented in a float
- Parameters
-
period | Period represented as a float in seconds |
- Returns
- Result of operation
Set period, milliseconds
- Parameters
-
ms | milliseconds for period |
- Returns
- Result of operation
Set period, microseconds
- Parameters
-
- Returns
- Result of operation
Set pulsewidth, As represnted by seconds in a (float)
- Parameters
-
seconds | The duration of a pulse |
- Returns
- Result of operation
Set pulsewidth, milliseconds
- Parameters
-
ms | milliseconds for pulsewidth |
- Returns
- Result of operation
The pulsewidth, microseconds
- Parameters
-
us | microseconds for pulsewidth |
- Returns
- Result of operation
Set the enable status of the PWM pin. None zero will assume on with output being driven and 0 will disable the output
- Parameters
-
enable | enable status of pin |
- Returns
- Result of operation
Set the period and duty of a PWM object.
- Parameters
-
period | represented in ms. |
duty | represnted in ms as float. |
- Returns
- Result of operation
Set the period and duty (percent) of a PWM object.
- Parameters
-
period | as represented in ms. |
duty | percentage i.e. 50% = 0.5f |
- Returns
- Result of operation
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/mraa-doc-stable/api/mraa/pwm.hpp