   if (bUpdateFlagsShared)
   {
     noInterrupts();
- 
     bUpdateFlags = bUpdateFlagsShared;
- 
     if (bUpdateFlags & AIL_FLAG)
     {
       unAIL_In = unAIL_InShared;

    }
 
    bUpdateFlagsShared = 0;
 
     bUpdateFlags = 0;
    interrupts();
  
    if (count == 10) {
      output = String(Thr/10) + ",";
      output += String(Rud/10) + ",";
      output += String(Ele/10) + ",";
      output += String(Ail/10) + ",";
      output += String(Aux/10) + "\n";
    Serial.print(output);
    count = 0;
    Rud = 0;
    Ail = 0;
    Thr = 0;
    Ele = 0;
    Aux = 0;
    output = "";
    } else {
      Thr+=unTHR_In;
      Rud+=unRUD_In;
      Ele+=unELE_In;
      Ail+=unAIL_In;
      Aux+=unAUX_In;
      count++;
    }
  }  
}

uint32_t ulTHR_Start;
uint32_t ulRUD_Start;
uint32_t ulAUX_Start;

int sampleRate = 10;
int samples = 0;
String output = "";
  
int16_t sampleRud = 0;
int16_t sampleAil = 0;
int16_t sampleThr = 0;
int16_t sampleEle = 0;
int16_t sampleAux = 0;

void setup()
{
  Serial.begin(9600); // SERIALLLLLLLLL.... 

  // setup the interrupt pins
  PCintPort::attachInterrupt(AIL_IN_PIN, isr_AIL, CHANGE); 
  PCintPort::attachInterrupt(ELE_IN_PIN, isr_ELE, CHANGE); 
  PCintPort::attachInterrupt(THR_IN_PIN, isr_THR, CHANGE);
