Treehopper Java API
io.treehopper.HardwarePwm Class Reference

Built-in hardware PWM channels. More...

Inheritance diagram for io.treehopper.HardwarePwm:
io.treehopper.interfaces.Pwm

Public Member Functions

boolean isEnabled ()
 Gets whether this PWM pin is enabled. More...
 
void setEnabled (boolean enabled)
 Sets whether this PWM pin is enabled. More...
 
double getPulseWidth ()
 Gets the pulse width of the pin. More...
 
void setPulseWidth (double pulseWidth)
 Sets the pulse width of the pin. More...
 
double getDutyCycle ()
 Gets the duty cycle of the pin. More...
 
void setDutyCycle (double dutyCycle)
 Sets the duty cycle of the pin. More...
 

Detailed Description

Built-in hardware PWM channels.

Note
Treehopper has two types of PWM support — Hardware and Software PWM. For information on software PWM functionality, visit Treehopper.Pin.

Treehopper has three 16-bit hardware PWM channels labeled PWM1, PWM2, and PWM3. Like all peripherals, these are accessible from the TreehopperUsb instance.

Member Function Documentation

◆ getDutyCycle()

double io.treehopper.HardwarePwm.getDutyCycle ( )

Gets the duty cycle of the pin.

Returns
the duty cycle, 0-1.

Implements io.treehopper.interfaces.Pwm.

◆ getPulseWidth()

double io.treehopper.HardwarePwm.getPulseWidth ( )

Gets the pulse width of the pin.

Returns
the pulse width, in microseconds

Implements io.treehopper.interfaces.Pwm.

◆ isEnabled()

boolean io.treehopper.HardwarePwm.isEnabled ( )

Gets whether this PWM pin is enabled.

Returns
whether this PWM pin is enabled

Implements io.treehopper.interfaces.Pwm.

◆ setDutyCycle()

void io.treehopper.HardwarePwm.setDutyCycle ( double  dutyCycle)

Sets the duty cycle of the pin.

Parameters
dutyCyclethe duty cycle, 0-1.

Implements io.treehopper.interfaces.Pwm.

◆ setEnabled()

void io.treehopper.HardwarePwm.setEnabled ( boolean  enabled)

Sets whether this PWM pin is enabled.

Parameters
enabledwhether this PWM pin is enabled

Implements io.treehopper.interfaces.Pwm.

◆ setPulseWidth()

void io.treehopper.HardwarePwm.setPulseWidth ( double  pulseWidth)

Sets the pulse width of the pin.

Parameters
pulseWidththe pulse width, in microseconds

Implements io.treehopper.interfaces.Pwm.


The documentation for this class was generated from the following file: