You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I download your code and compiled this to my Leonardo. It works fine but how do I access the Compass or Magnetometer output? I see only Accel and gyro....
MPU9150 has a magnetometer. Compass data (heading) has to be calculated based on the magnetometer data.
To get magnetometer working you will need to alter the sensor initialisation in mpu.cpp:
mpu_set_sensors(INV_XYZ_GYRO I INV_XYZ_ACCEL I INV_XYZ_COMPASS)
And set the sample rate for compass:
mpu_set_compass_sample_rate(50);
To read data: mpu_get_compass_reg(comp,NULL);
Where comp is short[3].
MPU9150 has a magnetometer. Compass data (heading) has to be calculated based on the magnetometer data.
To get magnetometer working you will need to alter the sensor initialisation in mpu.cpp:
mpu_set_sensors(INV_XYZ_GYRO I INV_XYZ_ACCEL I INV_XYZ_COMPASS)
And set the sample rate for compass:
mpu_set_compass_sample_rate(50);
To read data: mpu_get_compass_reg(comp,NULL);
Where comp is short[3].
MPU9150 has a magnetometer. Compass data (heading) has to be calculated based on the magnetometer data.
To get magnetometer working you will need to alter the sensor initialisation in mpu.cpp:
mpu_set_sensors(INV_XYZ_GYRO I INV_XYZ_ACCEL I INV_XYZ_COMPASS)
And set the sample rate for compass:
mpu_set_compass_sample_rate(50);
To read data: mpu_get_compass_reg(comp,NULL);
Where comp is short[3].
MPU9150 has a magnetometer. Compass data (heading) has to be calculated based on the magnetometer data.
To get magnetometer working you will need to alter the sensor initialisation in mpu.cpp:
mpu_set_sensors(INV_XYZ_GYRO I INV_XYZ_ACCEL I INV_XYZ_COMPASS)
And set the sample rate for compass:
mpu_set_compass_sample_rate(50);
To read data: mpu_get_compass_reg(comp,NULL);
Where comp is short[3].
Hi Greg, I put the commands in the mpu.cpp and the sketch compiles ok until I try and call up the compass.
I used the command "mympu.comp[0]"
but this is the error I get....
This report would have more information with "Show verbose output during compilation" enabled in File > Preferences.Arduino: 1.0.6 (Windows 7), Board: "Arduino Leonardo"AvrCopter.ino: In function 'void loop()':AvrCopter:44: error: 'struct s_mympu' has no member named 'comp'
Im really sorry for being a pain in the Ass!!! I sure appreciate your help in getting this to compile and run...
How should I call up the compass in my sketch to see my heading? I would try the link you sent me but the leonardo does not have enough memory to run it...
Activity
gregd72002 commentedon Dec 27, 2014
MPU9150 has a magnetometer. Compass data (heading) has to be calculated based on the magnetometer data.
To get magnetometer working you will need to alter the sensor initialisation in mpu.cpp:
mpu_set_sensors(INV_XYZ_GYRO I INV_XYZ_ACCEL I INV_XYZ_COMPASS)
And set the sample rate for compass:
mpu_set_compass_sample_rate(50);
To read data: mpu_get_compass_reg(comp,NULL);
Where comp is short[3].
See: https://github.com/rpicopter/AvrMiniCopter/blob/master/arduino/mpu.cpp
GOHO commentedon Dec 27, 2014
Thank you for the quick reply!!!
Merry Christmas!
Greg
Sent from my iPhone
On Dec 27, 2014, at 8:00 AM, gregd72002 notifications@github.com wrote:
GOHO commentedon Dec 27, 2014
One more question, what file do i add the compass sample rate? Do i add it to the mpu.cpp or my main sketch?
Thanks!
Greg
Sent from my iPhone
On Dec 27, 2014, at 8:00 AM, gregd72002 notifications@github.com wrote:
gregd72002 commentedon Dec 27, 2014
it should be in mpu.cpp in mympu_open function.
Similar to this: https://github.com/rpicopter/AvrMiniCopter/blob/master/arduino/mpu.cpp#L68
Please do not forget to create a pull request once you are finished.
Thanks
GOHO commentedon Dec 27, 2014
Ok found the set rate for compass in the mpu.cpp but what about the read compass, does that go into the mpu.cpp?
In the main sketch you have
mympu.gyro &
mympu.y.
To read the sensor, does the compass have the same type read command?
Thanks again
Greg
Sent from my iPhone
On Dec 27, 2014, at 8:00 AM, gregd72002 notifications@github.com wrote:
GOHO commentedon Dec 27, 2014
I appreciate all your help
Im am not sure what you mean by pull request.
G
Sent from my iPhone
On Dec 27, 2014, at 11:29 AM, gregd72002 notifications@github.com wrote:
gregd72002 commentedon Dec 27, 2014
it should go to mpu.cpp
As for the pull request I meant to contribute your work to this project.
See: https://help.github.com/articles/using-pull-requests/
[-]MPU9150[/-][+]MPU9150 - Magnetometer/Compass support[/+]GOHO commentedon Dec 27, 2014
Hi Greg, I put the commands in the mpu.cpp and the sketch compiles ok until I try and call up the compass.
I used the command "mympu.comp[0]"
but this is the error I get....
This report would have more information with "Show verbose output during compilation" enabled in File > Preferences.Arduino: 1.0.6 (Windows 7), Board: "Arduino Leonardo"AvrCopter.ino: In function 'void loop()':AvrCopter:44: error: 'struct s_mympu' has no member named 'comp'
Im really sorry for being a pain in the Ass!!! I sure appreciate your help in getting this to compile and run...
How should I call up the compass in my sketch to see my heading? I would try the link you sent me but the leonardo does not have enough memory to run it...
Greg Bounds772-571-7911
Date: Sat, 27 Dec 2014 08:53:33 -0800
From: notifications@github.com
To: ArduinoMotionSensorExample@noreply.github.com
CC: goldhoundgreg@hotmail.com
Subject: Re: [ArduinoMotionSensorExample] MPU9150 (#2)
it should go to mpu.cpp
As for the pull request I meant to contribute your work to this project.
See: https://help.github.com/articles/using-pull-requests/
—
Reply to this email directly or view it on GitHub.