 static uint16_t calibratingA = 0;  // the calibration is done in the main loop. Calibrating decreases at each cycle down to 0, then we enter in a normal mode.
 static int16_t  acc_25deg;
 
+#if defined(PRINTANGLE) || defined(PRINTANGLESUM)
+	#define GYRO_SCALE ((2380 * PI)/((32767.0f / 4.0f ) * 180.0f * 1000000.0f))
+	#define RADTODEG  57.2957795;
+#endif
 
 // ************************************************************************************************************
 // Main Program

// ************************************************************************************************************
// Helper Functions
// ************************************************************************************************************
void printRawData() //prints raw data over serial port in format "[gX     gY     gZ      aX      aY      aZ]\n"
{
	Serial.print("[");
	Serial.print(gyroADC[0]);
	Serial.print("\t\t");
	Serial.print(gyroADC[1]);
	Serial.print("\t\t");
	Serial.print(gyroADC[2]);
	Serial.print("\t\t");
	Serial.print(accADC[1]);
	Serial.print("\t\t");
	Serial.print(accADC[2]);
	Serial.print("\t\t");
	Serial.print(accADC[3]);
	Serial.println("]");
}

#if defined(SAMPLERATE)
		long ptime = 0;

// UNCOMMENT ONE OF THE FOUR OPTIONS BELOW

//#define PRINTDATA // uncomment to display raw data over serial port in format [gX     gY     gZ      aX      aY      aZ]
//#define PRINTANGLE // identical to PRINTDATA but gyro data is in delta degrees [gX     gY     gZ      aX      aY      aZ]
//#define PRINTANGLESUM // uncomment to display simple intigration of gyro over X axis in degrees
//#define SAMPLERATE // uncomment to display max sampling rate over serial port updates every 2 seconds with sampleing rate in Hz

#include <avr/eeprom.h>

