Overview   Project   Class   Tree   Index 
NXT C++ Bluetooth Library
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

NXT C++ Bluetooth Library
Class Adc_8591

Sensor
   |
   +--I2c
         |
         +--Adc_8591

   in adc_8591.h
   in adc_8591.cpp

class Adc_8591
extends I2c

Class for the PCF8591 8-bit A/D D/A converter (D/A feurures not implemented yet!)


 
Fields inherited from class I2c
wait_time, bytes_ready, i2c_address
   
Fields inherited from class Sensor
has_init, connection, sensor_type, sensor_mode, sensor_port, raw_AD_value, normalized_AD_value, scaled_value, calibrated_value
 
Constructor Summary
Adc_8591( Sensor_port port, Connection* connection, unsigned char i2c_address )
          Constructor for the PCF8591 ADC chip
~Adc_8591()
          
 
Method Summary
 Sensor_type get_type()
          Get the sensor type
 void init( bool reply = false )
          Initiate the sensor
 std::string print()
          Get the sensor reading as a string (init method will be called if the sensor has not been initialized)
 int read( Result& result )
          Get value from all four AD ports
   
Methods inherited from class I2c
init, i2c_write, i2c_read, wait_for_bytes, update_sensor_status, get_i2c_address, get_type
   
Methods inherited from class Sensor
init, read, read, print, set, get_port, get_mode, set_type_and_mode, get_sensor_value, read_mode, read_raw, read_normalized, get_type, reset, get_i2c_address
 

Constructor Detail

Adc_8591

public Adc_8591( Sensor_port port, Connection* connection, unsigned char i2c_address );
Constructor for the PCF8591 ADC chip
Parameters:
port - [which sensor port to use]
*connection - [attach a connection]
i2c_address - [set the I2C address of the chip]

~Adc_8591

public ~Adc_8591();


Method Detail

get_type

public Sensor_type get_type();
Get the sensor type
Returns:
ADC_8591_SENSOR

init

public void init( bool reply = false );
Initiate the sensor
Parameters:
reply - [true = require reply from NXT; false = no reply from NXT]

print

public std::string print();
Get the sensor reading as a string (init method will be called if the sensor has not been initialized)
Returns:
sensor reading as a string - "P0='some value' P1='some value' P2='some value' P3='some value'"

read

public int read( Result& result );
Get value from all four AD ports
Parameters:
&result - [must be of type Adc_ports - values are "stored" in result]
See Also:
Adc_ports

 Overview   Project   Class   Tree   Index 
NXT C++ Bluetooth Library
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD