Treehopper Java API
|
This class provides software-based pulse-width modulation (PWM) on any pin. More...
Public Member Functions | |
SoftPwm (TreehopperUsb board, Pin pin) | |
double | getDutyCycle () |
void | setDutyCycle (double dutyCycle) |
double | getPulseWidth () |
void | setPulseWidth (double pulseWidth) |
boolean | isEnabled () |
void | setEnabled (boolean enabled) |
String | toString () |
This class provides software-based pulse-width modulation (PWM) on any pin.
The period of the SoftPwm module defaults to approximately 60 Hz. Changing this period will affect all active SoftPwm pins.
Compared to HardwarePwm (which is implemented in hardware), SoftPwm has some jitter. However, it has good precision, fine-tuned period control, and works well even when many (or all!) Treehopper pins are used for SoftPwm.
io.treehopper.SoftPwm.SoftPwm | ( | TreehopperUsb | board, |
Pin | pin | ||
) |
double io.treehopper.SoftPwm.getDutyCycle | ( | ) |
Implements io.treehopper.interfaces.Pwm.
double io.treehopper.SoftPwm.getPulseWidth | ( | ) |
Implements io.treehopper.interfaces.Pwm.
boolean io.treehopper.SoftPwm.isEnabled | ( | ) |
Implements io.treehopper.interfaces.Pwm.
void io.treehopper.SoftPwm.setDutyCycle | ( | double | dutyCycle | ) |
Implements io.treehopper.interfaces.Pwm.
void io.treehopper.SoftPwm.setEnabled | ( | boolean | enabled | ) |
Implements io.treehopper.interfaces.Pwm.
void io.treehopper.SoftPwm.setPulseWidth | ( | double | pulseWidth | ) |
Implements io.treehopper.interfaces.Pwm.
String io.treehopper.SoftPwm.toString | ( | ) |