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

NXT C++ Bluetooth Library
Class Io_8574

Sensor
   |
   +--I2c
         |
         +--Io_8574

   in io_8574.h
   in io_8574.cpp

class Io_8574
extends I2c

Class for the PCF8574 8-bit I/O I2C chip


 
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
Io_8574( Sensor_port port, Connection* connection, unsigned char i2c_address )
          Constructor for the PCF8574 I/O chip
~Io_8574()
          
 
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()
          Read the sensor value (init method will be called if the sensor has not been initialized)
 void set( unsigned int value )
          Sets the pins high (write to the sensor)
   
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

Io_8574

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

~Io_8574

public ~Io_8574();


Method Detail

get_type

public Sensor_type get_type();
Get the sensor type
Returns:
IO_8574_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

read

public int read();
Read the sensor value (init method will be called if the sensor has not been initialized)
Returns:
a value between 0 and 255 that describes the state of the pins (remember to set input pins to high before reading)

set

public void set( unsigned int value );
Sets the pins high (write to the sensor)
Parameters:
value - [sets the specified pins high (0xff all pins are set to input)]

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