ioio.lib.impl
Class PwmImpl

java.lang.Object
  extended by ioio.lib.impl.AbstractResource
      extended by ioio.lib.impl.PwmImpl
All Implemented Interfaces:
Closeable, PwmOutput

public class PwmImpl
extends AbstractResource
implements PwmOutput


Constructor Summary
PwmImpl(IOIOImpl ioio, int pinNum, int pwmNum, int period, float baseUs)
           
 
Method Summary
 void close()
           
 void setDutyCycle(float dutyCycle)
          Sets the duty cycle of the PWM output.
 void setPulseWidth(float pulseWidthUs)
          The same as PwmOutput.setPulseWidth(int), but with sub-microsecond precision.
 void setPulseWidth(int pulseWidthUs)
          Sets the pulse width of the PWM output.
 
Methods inherited from class ioio.lib.impl.AbstractResource
disconnected
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PwmImpl

public PwmImpl(IOIOImpl ioio,
               int pinNum,
               int pwmNum,
               int period,
               float baseUs)
        throws ConnectionLostException
Throws:
ConnectionLostException
Method Detail

close

public void close()
Specified by:
close in interface Closeable
Overrides:
close in class AbstractResource

setDutyCycle

public void setDutyCycle(float dutyCycle)
                  throws ConnectionLostException
Description copied from interface: PwmOutput
Sets the duty cycle of the PWM output. The duty cycle is defined to be the pulse width divided by the total cycle period. For absolute control of the pulse with, consider using PwmOutput.setPulseWidth(int).

Specified by:
setDutyCycle in interface PwmOutput
Parameters:
dutyCycle - The duty cycle, as a real value from 0.0 to 1.0.
Throws:
ConnectionLostException - The connection to the IOIO has been lost.
See Also:
PwmOutput.setPulseWidth(int)

setPulseWidth

public void setPulseWidth(int pulseWidthUs)
                   throws ConnectionLostException
Description copied from interface: PwmOutput
Sets the pulse width of the PWM output. The pulse width is duration of the high-time within a single period of the signal. For relative control of the pulse with, consider using PwmOutput.setDutyCycle(float).

Specified by:
setPulseWidth in interface PwmOutput
Parameters:
pulseWidthUs - The pulse width, in microsecond units.
Throws:
ConnectionLostException - The connection to the IOIO has been lost.
See Also:
PwmOutput.setDutyCycle(float)

setPulseWidth

public void setPulseWidth(float pulseWidthUs)
                   throws ConnectionLostException
Description copied from interface: PwmOutput
The same as PwmOutput.setPulseWidth(int), but with sub-microsecond precision.

Specified by:
setPulseWidth in interface PwmOutput
Throws:
ConnectionLostException