Go Down

Topic: Sketch for LSM303 sensor (Read 224 times) previous topic - next topic

Corci

Oct 25, 2013, 05:38 pm Last Edit: Oct 25, 2013, 05:54 pm by Corci Reason: 1
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();
}

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy