Good evening,

I have been struggling with this one for several months have had to keep coming back to it to save my sanity. I will do my best to explain the problem. I have used Jim's annunciator code but because the annunciator section of link2fs does not have a couple of conditions I wanted I created them manually using void QUESTION. When the aircraft is flying all of the led's come on and go off when they are supposed to. The problem comes when I have tried to add a push to test button.

Lets say that I'm flying along and I want to press the button, I press it and they all come on like they are supposed to and go off when the button is released. If I go and press the button again nothing will happen until I either disconnect and reconnect the card or cause one of the annunciator lights to come on. What is interesting is when the button stops working only one of the annunciator lights will get it working again but not void QUESTION lights.
I am hoping that makes sense. I will attach the code below for your perusal.

Something else that I have done is to not use the annunciator code at all and create them all manually but again Im not aure how to incorporate the PTT button.
Any help would be gratefully received.
Thanks
Marc

Code:
int AnunPinNo[5] = {2, 3, 4, 5, 6};// the selected pins with LED'schar AnunIdent2[5] = {'E','N','F','H','R'};//Selected items in "Annunciators" in Multi
long AnunButtonStop = 0;
boolean ButtonStopEnable = 0;
int AnunPinValNew[5] = {0,0,0,0,0};//Array for pin values (The new readings)
int AnunPinValOld[5] = {0,0,0,0,0};//Array for pin values (The old readings)
int count = 0; //for array reading
int CodeIn;// Gets the serial read
int pttButton = 12;// Button to test all annunciations
int bipassSwitchPins = 0; //=1 avoids repetative pin assignments
int dummy;//dummy output until LED's are restored after test
int AnunPinTot = 0;//Used for cancelling alarms if fault disappears before pushing button
int KpinNo; 
int Koutpin;
String start;
String pitot;
String warn,gear;
unsigned int warnalarm;
unsigned int gearalarm;
String KoldpinStateSTR, KpinStateSTR, Kstringnewstate,Kstringoldstate;




void setup(){
  Kstringoldstate = "111111111111111111111111111111111111111111111111111111111111111111111";




  for (int KoutPin = 10; KoutPin < 12; KoutPin++)// Get these pins ready as inputs  
  {
    pinMode(KoutPin, INPUT);
    digitalWrite(KoutPin, HIGH);  
  }
  
  for (count=0;count<9;count++) {// we make all the Anun declarations at once
    // Be careful with the above line.(Dont involve a pin that will have a switch on it ,, it can fry your pin or card)
    pinMode(AnunPinNo[count], OUTPUT);
   digitalWrite(AnunPinNo[count], LOW); 




   pinMode(7, OUTPUT);
   digitalWrite(7, LOW);
   pinMode(8, OUTPUT);
   digitalWrite(8, LOW);
   pinMode(9, OUTPUT);
   digitalWrite(9, LOW);




   pinMode(pttButton, INPUT_PULLUP);




  Serial.begin(115200);
}}




void loop() {
  {KEYS();} //Check the "keys" section
  {OTHER();}
  {PUSHTOTEST();}
  if (Serial.available()) { 
    CodeIn = getChar();   
    if (CodeIn == '=') {EQUALS();} 
    if (CodeIn == '<') {LESSTHAN();}
    if (CodeIn == '?') {QUESTION();}
    if (CodeIn == '/') {SLASH();}
  }
}




char getChar()
{
  while(Serial.available() == 0);
  return((char)Serial.read());
}




void OTHER(){
   // Normal "run" stuff in here
}




void EQUALS(){      
       CodeIn = getChar();
  switch(CodeIn) {
    case 'A':
       //Do something
    break;
     
    case 'W':
       //Do something
    break;
     
    case 'a':
       //Do something
    break;
       //etc etc etc
     }
}




void LESSTHAN(){ 
  CodeIn = getChar(); // Get another character
  switch(CodeIn) {// Now lets find what to do with it
     case 'b':{
      pitot = "";
      pitot += getChar();
      int pitotInt = pitot.toInt(); // convert it to an integer (Thanks Phill)
      if (pitotInt == 1) {digitalWrite(8, HIGH);} else {digitalWrite(8, LOW);}
      break;
     }




      case 'k':{
      start = "";
      start += getChar();
      int startInt = start.toInt();
      if (startInt == 1) {digitalWrite(9, HIGH);} else {digitalWrite(9, LOW);}
      }
    
  }   
    }
      
void QUESTION(){    // The first identifier was "?"
 CodeIn = getChar(); // Get another character
  switch(CodeIn) {// Now lets find what to do with it
    {
 case 'Q'://The second identifier was an "Q" = Manifold pressure
warn = "";
warn += getChar();
warn += getChar();
warn += getChar();
warn += getChar();
int warnInt = warn.toInt();
//values below Q12.0 (psi) will give alarm.
if(warnInt < 7){warnalarm = 1;}
else
{warnalarm = 0;}
Serial.println("warnalarm"); //for debugging
Serial.println(warnalarm); //for debugging
break;}    
{
case 'Y'://The second identifier was an "Y" = Gear position
gear = "";
gear += getChar();
gear += getChar();
gear += getChar();
int gearInt = gear.toInt();
//values below Y222 (gear not fully extended) will give alarm.
if (gearInt <222) {gearalarm = 1;}
else
{gearalarm = 0;}
Serial.println("gearalarm"); //for debugging
Serial.println(gearalarm); //for debugging
break; } 
}
if (warnalarm == 1 && gearalarm == 1) {digitalWrite(7, HIGH);}
else{digitalWrite(7, LOW);}
}




 




     
void SLASH(){    // The first identifier was "/" (Annunciators)
  CodeIn = getChar();
  for (count=0;count<9;count++) {
   if (CodeIn == AnunIdent2[count]){
      AnunPinValNew[count] = (getChar()- 48); 
     if (AnunPinValNew[count] == 1){ 
       if (AnunPinValOld[count] < 1) {digitalWrite(AnunPinNo[count], HIGH);
        
         AnunPinValOld[count] = AnunPinValNew[count];}}
     if (AnunPinValNew[count] == 0){
       if (AnunPinValOld[count] > 0) {digitalWrite(AnunPinNo[count], LOW);AnunPinValOld[count] = AnunPinValNew[count]; 
   }}}}}




   void KEYS() 
{
  Kstringnewstate = "";
  for (int KpinNo = 10; KpinNo < 12; KpinNo++){
    KpinStateSTR = String(digitalRead(KpinNo)); 
    KoldpinStateSTR = String(Kstringoldstate.charAt(KpinNo - 10));
    if (KpinStateSTR != KoldpinStateSTR)
    {
      if (KpinNo == 10){if (KpinStateSTR == "1" ){Serial.println ("E42");}else {Serial.println ("E43");}}//Start
      if (KpinNo == 11){if (KpinStateSTR == "1" ){Serial.println ("C05");}else {Serial.println ("C06");}}//Pitot
    }
    Kstringnewstate += KpinStateSTR;
  }
   Kstringoldstate = Kstringnewstate;
  }




  void PUSHTOTEST()
{
if (digitalRead(12)==0){
if (bipassSwitchPins != 1){
for (count=2; count<10; count++) digitalWrite(count,HIGH);
bipassSwitchPins = 1;
}
AnunButtonStop = millis() + 400;
ButtonStopEnable = 1;
}
// cleanup
if (((millis()) > AnunButtonStop) && ButtonStopEnable == 1){
for (count=2; count<10; count++) {digitalWrite(count,LOW); }
{AnunPinNo[0] = 2; AnunPinNo[1] = 3; AnunPinNo[2] = 4; AnunPinNo[3] = 5;}
{AnunPinNo[4] = 6; AnunPinNo[5] = 7;}
for (count=0;count<10;count++) {
if (AnunPinValOld[count] == 1) {digitalWrite(AnunPinNo[count],AnunPinValOld[count]); 


{ButtonStopEnable = 0; bipassSwitchPins = 0;} // remove enable keys on exit
}
}
}
}