Pages: [1]   Go Down
Author Topic: Sketch for LSM303 sensor  (Read 157 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all!
I'm trying to work with the 3-axis accelerometer and 3-axis magnetometer LSM303, using Arduino and Labview. I found an example of sketch on-line and I'm studying and analyzing it. Could someone help me with these part of the code? Why the two void functions are realized in different kind? Thanks.

void getLSM303_accel(int * rawValues) //
{
  rawValues[Z] = ((int)LSM303_read(OUT_X_L_A) << 8 ) | (LSM303_read(OUT_X_H_A)); // combinazione di MSB ed LSB
  rawValues[X] = ((int)LSM303_read(OUT_Y_L_A) << 8 ) | (LSM303_read(OUT_Y_H_A));
  rawValues[Y] = ((int)LSM303_read(OUT_Z_L_A) << 8 ) | (LSM303_read(OUT_Z_H_A));  
  //
}

void getLSM303_mag(int * rawValues)
{
  Wire.beginTransmission(LSM303_MAG);
  Wire.write(OUT_X_H_M);
  Wire.endTransmission();
  Wire.requestFrom(LSM303_MAG, 6);
  for (int i=0; i<3; i++)
    rawValues = (Wire.read() << 8 ) | Wire.read();
}
« Last Edit: October 25, 2013, 10:54:01 am by Corci » Logged

Pages: [1]   Go Up
Jump to: