-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MPU9150 - Magnetometer/Compass support #2
Comments
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: And set the sample rate for compass: To read data: mpu_get_compass_reg(comp,NULL); See: https://github.com/rpicopter/AvrMiniCopter/blob/master/arduino/mpu.cpp |
Thank you for the quick reply!!! Merry Christmas! Greg Sent from my iPhone On Dec 27, 2014, at 8:00 AM, gregd72002 [email protected] wrote:
|
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! Sent from my iPhone On Dec 27, 2014, at 8:00 AM, gregd72002 [email protected] wrote:
|
it should be in mpu.cpp in mympu_open function. Please do not forget to create a pull request once you are finished. Thanks |
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 Thanks again Greg Sent from my iPhone On Dec 27, 2014, at 8:00 AM, gregd72002 [email protected] wrote:
|
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 [email protected] wrote:
|
it should go to mpu.cpp As for the pull request I meant to contribute your work to this project. |
Hi Greg, I put the commands in the mpu.cpp and the sketch compiles ok until I try and call up the compass. 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 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/ —
|
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....
The text was updated successfully, but these errors were encountered: