Module zio :: Class ADC

Class ADC

object --+        
         |        
    Module --+    
             |    
        Analog --+
                 |
                ADC

ADC class is used to access analog inputs usually driven by sensors.
Instance Methods
 
__init__(self, agent)
Constructs an ADC object.
int
read_pin_raw(self, pin)
Reads and returns the value on the specified analog input pin.
list of ints
read_raw(self)
Reads and returns the value (0 - 0xFFFF) on all analog input pins.
list of floats
read(self)
Reads and returns the value (0 - Vref) on all analog input pins.
float
read_pin(self, pin)
Reads and returns the value on the specified analog input pin.

Inherited from Module: do_op

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties
  input_pin_count
The no.

Inherited from Analog: vref

Inherited from object: __class__

Method Details

__init__(self, agent)
(Constructor)

 
Constructs an ADC object.
Parameters:
  • agent (Agent) - the agent interface object
Raises:
  • ProtocolError - If communication with agent fails or if data sent or received is corrupted
Overrides: object.__init__

read_pin_raw(self, pin)

 
Reads and returns the value on the specified analog input pin. The returned value represents the analog input as quantized levels in the range 0 to 0xFFFF.
Returns: int
the value read from the pin

See Also: ADC.read_pin

read_raw(self)

 
Reads and returns the value (0 - 0xFFFF) on all analog input pins.
Returns: list of ints
the values read from the analog pins

read(self)

 
Reads and returns the value (0 - Vref) on all analog input pins.
Returns: list of floats
the data read from the pins.
Raises:
  • ProtocolError - If communication with agent fails or or if data sent or received is corrupted

read_pin(self, pin)

 
Reads and returns the value on the specified analog input pin. The returned value represents the analog input as a value in the range 0 to Vref.
Returns: float
the value read from the pin

Property Details

input_pin_count

The no. of input pins available in this module.
Get Method:
_get_input_pin_count(self)