 }
 
 void setup() {
+	 // join I2C bus (I2Cdev library doesn't do this automatically)
+    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
+        Wire.begin();
+    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
+        Fastwire::setup(400, true);
+    #endif
+    
+    accelgyro.initialize();
+    accel2.initialize();
+    mag.initialize();
+
 	Serial.begin(57600);        // connect to the serial port
 
 	softReset();

		Serial.write((byte)(loadTime >> 8));
		Serial.write((byte) loadTime & 0xFF);
	}


} // end of big loop

*
*/

#include "I2Cdev.h"
#include "MPU6050.h"
#include "ADXL345.h"
#include <HMC5883L.h>

#include <Servo.h>
 
MPU6050 accelgyro;
ADXL345 accel2;
HMC5883L mag;
//MPU6050 accelgyro(0x69); // <-- use for AD0 high
 
int16_t ax, ay, az;
int16_t gx, gy, gz;
int16_t ax2, ay2, az2;
int16_t mx, my, mz;
int cnt;

// ----------  MRLCOMM FUNCTION INTERFACE BEGIN -----------
#define MRLCOMM_VERSION				20
