Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Files | Defines | Functions | Variables

ACCEL-nx Sensor
[Mindsensors]

Files

file  mindsensors-accelerometer.h
 

Mindsensors ACCEL-nx driver.


Defines

#define MSAC_I2C_ADDR   0x02
#define MSAC_CMD   0x41
#define MSAC_X_TILT   0x42
#define MSAC_Y_TILT   0x43
#define MSAC_Z_TILT   0x44
#define MSAC_X_ACCEL   0x45
#define MSAC_Y_ACCEL   0x47
#define MSAC_Z_ACCEL   0x49
#define MSAC_RANGE_2_5   1
#define MSAC_RANGE_3_3   2
#define MSAC_RANGE_6_7   3
#define MSAC_RANGE_10   4

Functions

bool MSACreadTilt (tSensors link, int &x_tilt, int &y_tilt, int &z_tilt)
bool MSACreadAccel (tSensors link, int &x_accel, int &y_accel, int &z_accel)
bool MSACsendCmd (tSensors link, byte command)
bool MSACsetRange (tSensors link, int range)

Variables

tByteArray MSAC_I2CRequest
tByteArray MSAC_I2CReply

Detailed Description

ACCEL-nx Sensor


Define Documentation

#define MSAC_CMD   0x41

MSAC command register

Definition at line 46 of file mindsensors-accelerometer.h.

#define MSAC_I2C_ADDR   0x02

MSAC I2C device address

Definition at line 44 of file mindsensors-accelerometer.h.

#define MSAC_RANGE_10   4

Acceleration up to 10G

Examples:
mindsensors-accelerometer-test1.c, and mindsensors-accelerometer-test2.c.

Definition at line 59 of file mindsensors-accelerometer.h.

#define MSAC_RANGE_2_5   1

Acceleration up to 2.5G

Definition at line 56 of file mindsensors-accelerometer.h.

#define MSAC_RANGE_3_3   2

Acceleration up to 3.3G

Definition at line 57 of file mindsensors-accelerometer.h.

#define MSAC_RANGE_6_7   3

Acceleration up to 6.7G

Definition at line 58 of file mindsensors-accelerometer.h.

#define MSAC_X_ACCEL   0x45

MSAC Z acceleration data

Definition at line 52 of file mindsensors-accelerometer.h.

#define MSAC_X_TILT   0x42

MSAC X tilt data

Definition at line 48 of file mindsensors-accelerometer.h.

#define MSAC_Y_ACCEL   0x47

MSAC Z acceleration data

Definition at line 53 of file mindsensors-accelerometer.h.

#define MSAC_Y_TILT   0x43

MSAC Y tilt data

Definition at line 49 of file mindsensors-accelerometer.h.

#define MSAC_Z_ACCEL   0x49

MSAC Z acceleration data

Definition at line 54 of file mindsensors-accelerometer.h.

#define MSAC_Z_TILT   0x44

MSAC Z tilt data

Definition at line 50 of file mindsensors-accelerometer.h.


Function Documentation

bool MSACreadAccel ( tSensors  link,
int &  x_accel,
int &  y_accel,
int &  z_accel 
)

Read tilt data from the sensor

Parameters:
linkthe sensor port number
x_accelX acceleration data
y_accelY acceleration data
z_accelZ acceleration data
Returns:
true if no error occured, false if it did
Examples:
mindsensors-accelerometer-test1.c, and mindsensors-sensormux-test1.c.

Definition at line 104 of file mindsensors-accelerometer.h.

bool MSACreadTilt ( tSensors  link,
int &  x_tilt,
int &  y_tilt,
int &  z_tilt 
)

Read tilt data from the sensor

Parameters:
linkthe sensor port number
x_tiltX tilt data
y_tiltY tilt data
z_tiltZ tilt data
Returns:
true if no error occured, false if it did
Examples:
mindsensors-accelerometer-test1.c, and mindsensors-accelerometer-test2.c.

Definition at line 78 of file mindsensors-accelerometer.h.

bool MSACsendCmd ( tSensors  link,
byte  command 
)

Send a command to the sensor

Parameters:
linkthe sensor port number
commandthe command to be sent
Returns:
true if no error occured, false if it did

Definition at line 128 of file mindsensors-accelerometer.h.

bool MSACsetRange ( tSensors  link,
int  range 
)

Set sensitivity range of sensor.

Parameters:
linkthe sensor port number
range1 = 2.5G, 2 = 3.3G, 3 = 6.7G, 4 = 10G
Returns:
true if no error occured, false if it did
Examples:
mindsensors-accelerometer-test1.c, and mindsensors-accelerometer-test2.c.

Definition at line 146 of file mindsensors-accelerometer.h.


Variable Documentation

Array to hold I2C reply data

Definition at line 67 of file mindsensors-accelerometer.h.

Array to hold I2C command data

Definition at line 66 of file mindsensors-accelerometer.h.