I am slowly working through validating all the diffrent parts of hardware for my Quad and I got to the Compass today.
With the break-away sides removed it fits nicely on-top of the Oilpan. The I2C holes line up well. It does stick a little off the end, but thats ok.
The only problem is that the axis directions of the board are now different from the ones for the APM/Oilpan.
I have been using the mounting orientation that arducoptor guys are using.
Attached to this post is simple NMEA test code.
Its based on the TinyGPS library available at http://arduiniana.org/libraries/tinygps/
The code that outputs the data should be self explanatory except for the initialize line.
In this case I modified the Init method to take a pointer to the serial port you want to use and the baud rate. That way the serial port and baudCode:GPS.Init(&Serial1, 4800); // GPS Initialization
Well after getting my replacement ArduPilot Mega from SparkFun today I wen't about attaching as little as possible to it and testing the RX inputs (since thats what wasn't working on the first board I received).
One thing I learned (and hopefully by posting this other people won't fall into the same problem) is that ALL the channels need to be connected to a pwm source (either your receiver or in my case my other APMega that was slowing ticking its way through the 1000-2000 pwm pulse
Here are the relevant pins and some sample code for working with the accessories on the APMega/IMU board.
Switching ON SW2 should turn the relay ON and close the circuit for the ground and 1 pin, switching SW2 off will turn the relay off and close the circuit for the ground pin and pin 0.
LEDs should blink every 1/5th of a second and should stop blinking when you push SW1.
I haven't yet coded the DIP switch as 2 of the pins are available through Arduino
Most of the code listed at the various links on diydrones that point to a APM_ADC code base have the pin outs all wrong for the shipping version of the boards.
Listed below is a working version that can read all 7 ADC channels.
APM_ADC.h
Code:#ifndef APM_ADC_h #define APM_ADC_h #define bit_set(p,m) ((p) |= (1<<m)) #define bit_clear(p,m) ((p) &= ~(1<<m)) #define ADC_CHIP_SELECT 33 //PC4