/**
  * returns the mean of N raw values of aixs indicated by the index number .
  *
  * @param index Indicates the axis (x=0,y=1,z=2).
  * @return The mean value.
  */
 private float getRawMean(int index) {
   int t = 0;
   for (int i = 1; i <= samples; i++) {
     accel.fetchRawAccel(raw);
     t += raw[index];
     try {
       Thread.sleep(10);
     } catch (InterruptedException ex) {
     }
   }
   return t / samples;
 }
 /**
  * Displays the raw value of axis indicated by index. A low pass filter is applied on the raw
  * values to make reading easier.
  *
  * @param index Indicates the axis (x=0,y=1,z=2).
  */
 private void showLowPass(int index) {
   float alpha = 0.95f;
   float lowpassed = 0;
   while (!Button.ENTER.isDown()) {
     accel.fetchRawAccel(raw);
     lowpassed = alpha * raw[index] + (1.0f - alpha) * lowpassed;
     LCD.drawString(Double.toString(lowpassed), 0, 3);
     try {
       Thread.sleep(150);
     } catch (InterruptedException ex) {
     }
   }
   while (Button.ENTER.isDown()) ;
 }