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

NXT C++ Bluetooth Library
Class Tilt

Sensor
   |
   +--I2c
         |
         +--Tilt

   in tilt.h
   in tilt.cpp

class Tilt
extends I2c

Class for HiTechnic tilt/accekeration sensor


 
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
Tilt( Sensor_port port, Connection* connection, unsigned char i2c_address = 0x02 )
          Constructor for the Tilt sensor
~Tilt()
          
 
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 the X-Y-Z coordinates (init method will be called if the sensor has not been initialized)
   
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

Tilt

public Tilt( Sensor_port port, Connection* connection, unsigned char i2c_address = 0x02 );
Constructor for the Tilt sensor
Parameters:
port - [which sensor port to use]
*connection - [attach a connection]
i2c_address - [set the I2C address of the sensor (just use the default address unless you have done a hack)]

~Tilt

public ~Tilt();


Method Detail

get_type

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

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 - "x='some value' y='some value' z='some value'"

read

public int read( Result& result );
Get the X-Y-Z coordinates (init method will be called if the sensor has not been initialized)
Parameters:
&result - [must be of type Xyz_position - coordinates are "stored" in result]
See Also:
Xyz_position

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