Pwm Class
This file defines the PWM interface for libmraa
Item Index
Methods
Pwm
-
pin
-
owner
-
chipid
instanciates a PWM object on a pin
Parameters:
-
pin
Numberthe pin number used on your board
-
owner
Booleanif you are the owner of the pin the destructor will unexport the pin from sysfs, default behaviour is you are the owner if the pinmapper exported it
-
chipid
Numberthe pwmchip to use, use only in raw mode
Returns:
write
-
percentage
Set the output duty-cycle percentage, as a float
Parameters:
-
percentage
NumberA floating-point value representing percentage of output. The value should lie between 0.0f (representing 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
()
Number
Read the output duty-cycle percentage, as a float
Returns:
A floating-point value representing percentage of output. The value should lie between 0.0f (representing 0%) and 1.0f Values above or below this range will be set at either 0.0f or 1.0f
period
-
period
Set the PWM period as seconds represented in a float
Parameters:
-
period
NumberPeriod represented as a float in seconds
Returns:
Result of operation
period_ms
-
ms
Set period, milliseconds
Parameters:
-
ms
Numbermilliseconds for period
Returns:
Result of operation
period_us
-
us
Set period, microseconds
Parameters:
-
us
Numbermicroseconds as period
Returns:
Result of operation
pulsewidth
-
seconds
Set pulsewidth, as represented by seconds in a float
Parameters:
-
seconds
NumberThe duration of a pulse
Returns:
Result of operation
pulsewidth_ms
-
ms
Set pulsewidth, milliseconds
Parameters:
-
ms
Numbermilliseconds for pulsewidth
Returns:
Result of operation
pulsewidth_us
-
us
The pulsewidth, microseconds
Parameters:
-
us
Numbermicroseconds for pulsewidth
Returns:
Result of operation
enable
-
enable
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
Booleanenable status of pin
Returns:
Result of operation
max_period
()
Number
Get the maximum PWM period in us
Returns:
max PWM period in us
min_period
()
Number
Get the minimum PWM period in us
Returns:
min PWM period in us