ioio.lib.impl
Class AnalogInputImpl

java.lang.Object
  extended by ioio.lib.impl.AbstractResource
      extended by ioio.lib.impl.AbstractPin
          extended by ioio.lib.impl.AnalogInputImpl
All Implemented Interfaces:
AnalogInput, Closeable

public class AnalogInputImpl
extends AbstractPin
implements AnalogInput


Method Summary
 void close()
           
 void disconnected()
           
 float getReference()
          Gets the maximum value against which AnalogInput.read() values are scaled.
 float getVoltage()
          Gets the analog input reading, as an absolute voltage in Volt units.
 float read()
          Gets the analog input reading, as a scaled real value between 0 and 1.
 void setValue(int value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getVoltage

public float getVoltage()
                 throws java.lang.InterruptedException,
                        ConnectionLostException
Description copied from interface: AnalogInput
Gets the analog input reading, as an absolute voltage in Volt units.

It typically takes a few milliseconds between when the instance is created and until the first value can be read. In this case, the method may block shortly. If this is a problem, the calling thread can be interrupted.

If a scaled value is desired, consider using AnalogInput.read().

Specified by:
getVoltage in interface AnalogInput
Returns:
The voltage, in Volt units.
Throws:
java.lang.InterruptedException - The calling thread has been interrupted.
ConnectionLostException - The connection with the IOIO is lost.
See Also:
AnalogInput.read()

getReference

public float getReference()
Description copied from interface: AnalogInput
Gets the maximum value against which AnalogInput.read() values are scaled.

Specified by:
getReference in interface AnalogInput
Returns:
The voltage, in Volts.

setValue

public void setValue(int value)

read

public float read()
           throws java.lang.InterruptedException,
                  ConnectionLostException
Description copied from interface: AnalogInput
Gets the analog input reading, as a scaled real value between 0 and 1.

It typically takes a few milliseconds between when the instance is created and until the first value can be read. In this case, the method may block shortly. If this is a problem, the calling thread can be interrupted.

If an absolute value is desired, consider using AnalogInput.getVoltage().

Specified by:
read in interface AnalogInput
Returns:
The voltage, in scaled units.
Throws:
java.lang.InterruptedException - The calling thread has been interrupted.
ConnectionLostException - The connection with the IOIO is lost.
See Also:
AnalogInput.getVoltage()

disconnected

public void disconnected()
Overrides:
disconnected in class AbstractResource

close

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