public class PWM
extends java.lang.Object
PWM channel
lets you control the physical module PWM interface.
To obtain an instance of the PWM you have to use the
PWMManager.createPWM(int) method.
| Modifier and Type | Field and Description |
|---|---|
static int |
FREQUENCY
Default frequency configured in the PWM: 21000 Hz.
|
static long |
PERIOD
Default period configured in the PWM: 47619L nanoseconds.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getChannelIndex()
Retrieves the PWM channel index.
|
double |
getDutyCycle()
Retrieves the duty cycle percentage configured in this PWM channel.
|
void |
setDutyCycle(double dutyCycle)
Sets the duty cycle percentage of the PWM signal.
|
public static final int FREQUENCY
public static final long PERIOD
public int getChannelIndex()
public void setDutyCycle(double dutyCycle)
throws java.lang.IllegalArgumentException,
PWMException
dutyCycle - The duty cycle percentage of the PWM signal (0 to 100%).java.lang.IllegalArgumentException - If dutyCycle < 0 or dutyCycle > 100.PWMException - If there is any error setting the duty cycle.public double getDutyCycle()
throws PWMException
PWMException - If there is any error reading the duty cycle.