Guide to gyro and accelerometer with Arduino including Kalman filtering

hey mate glad u liked it couldn't have done it without your help :wink: , maybe i can return the favour with simplot

on the main screen the only thing to add it this line

  compAngleX = (0.98*(compAngleX+(gyroXrate*dtime/1000)))+(0.02*(accXangle));
 
  xAngle = kalmanCalculateX(accXangle, gyroXrate, dtime);
 

 plot(accXangle, gyroXangle, xAngle, compAngleX);       <<<<<<<<<<<<<this line 
 processing();
  set_motor();
  delay(10);
  }

then add this to a new tab

void plot(int data1, int data2, int data3, int data4)
{
  int pktSize;
  int buffer[20]; //Buffer needed to store data packet for transmission
  buffer[0] = 0xCDAB;             //SimPlot packet header. Indicates start of data packet
  buffer[1] = 4*sizeof(int);      //Size of data in bytes. Does not include the header and size fields
  buffer[2] = data1;
  buffer[3] = data2;
  buffer[4] = data3;
  buffer[5] = data4;
  pktSize = 2 + 2 + (4*sizeof(int)); //Header bytes + size field bytes + data
  Serial.write((uint8_t * )buffer, pktSize);
}
void plot(int data1, int data2, int data3)
{
  int pktSize;
  int buffer[20]; //Buffer needed to store data packet for transmission
  buffer[0] = 0xCDAB;             //SimPlot packet header. Indicates start of data packet
  buffer[1] = 3*sizeof(int);      //Size of data in bytes. Does not include the header and size fields
  buffer[2] = data1;
  buffer[3] = data2;
  buffer[4] = data3;
  pktSize = 2 + 2 + (3*sizeof(int)); //Header bytes + size field bytes + data
  Serial.write((uint8_t * )buffer, pktSize);
}
void plot(int data1, int data2)
{
  int pktSize;
  int buffer[20]; //Buffer needed to store data packet for transmission
  buffer[0] = 0xCDAB;             //SimPlot packet header. Indicates start of data packet
  buffer[1] = 2*sizeof(int);      //Size of data in bytes. Does not include the header and size fields
  buffer[2] = data1;
  buffer[3] = data2;
  pktSize = 2 + 2 + (2*sizeof(int)); //Header bytes + size field bytes + data
  Serial.write((uint8_t * )buffer, pktSize);
}
void plot(int data1)
{
  int pktSize;
  int buffer[20]; //Buffer needed to store data packet for transmission
  buffer[0] = 0xCDAB;             //SimPlot packet header. Indicates start of data packet
  buffer[1] = 1*sizeof(int);      //Size of data in bytes. Does not include the header and size fields
  buffer[2] = data1;
  pktSize = 2 + 2 + (1*sizeof(int)); //Header bytes + size field bytes + data
  Serial.write((uint8_t * )buffer, pktSize);
}

i found all this imformation from this page in the arduino forum http://arduino.cc/forum/index.php/topic,58911.0.html
all thanks going to "Brijesh" he designed the software