I am Newb building a Landing gear and flap panel for my F-18cockpit.I am using Jim NZ Link2fS. (GreatWork by Jim) I am using one Arduino for the landing gear and the second one forthe Flaps.I have set up the flaps fortwo positions HALF and Full. Witch the sketch is working well.When I add the airspeed statement I get anerror

f18_flaps_test.ino: In function 'void LESSTHAN()':
f18_flaps_test:55: error: jump to case label
f18_flaps_test:48: error: crosses initialization of 'int flapsInt'
f18_flaps_test:69: error: a function-definition is not allowed herebefore '{' token

I have found this sketch (Again thanks to Jim)that I am using below is Jim’ssketch that I am trying to improve on.Can anybody tell me what I am doing wrong? I have no programingexperience and most of it is Greek to me.

int CodeIn;// used on all serial reads
int KpinNo;
int Koutpin;
String flaps;
String Airspeed;

String KoldpinStateSTR, KpinStateSTR, Kstringnewstate,Kstringoldstate;

void setup()
Kstringoldstate ="111111111111111111111111111111111111111111111111111111111111111111111";

for (int KoutPin = 8; KoutPin < 13; KoutPin++)// Set's up all theinput pins
pinMode(KoutPin, INPUT);
digitalWrite(KoutPin, HIGH);
pinMode(2, OUTPUT); // Flaps are up LED
pinMode(2, OUTPUT); // Flaps are "Not up" LED
pinMode(4, OUTPUT); // Flaps are down 1st position LED
pinMode(5, OUTPUT); // Flaps are down 2nd position LED


void loop() {
{KEYS();} //Check the "keys" section
if (Serial.available()) {
CodeIn = getChar();//get a character
if (CodeIn == '<') {LESSTHAN();}// The first identifier is"<"
}//end of serial check
}//end of void loop

char getChar()// Get a character from the serial buffer
while(Serial.available() == 0);// wait for data
return((char)Serial.read());// Thanks Doug

void LESSTHAN(){ // The first identifier was "<"
CodeIn = getChar(); // Get another character
switch(CodeIn) {// Now lets find what to do with it
case 'G'://Found the second identifier ("G" Flaps position)
flaps = "";
flaps += getChar();
flaps += getChar();
flaps += getChar();
int flapsInt = flaps.toInt(); // convert it to an integer (ThanksPhill)

if (flapsInt > 10 && flapsInt < 80) {digitalWrite(3,HIGH);} else {digitalWrite(3, LOW);}
if (flapsInt > 75) {digitalWrite(4, HIGH);} else {digitalWrite(5,LOW);}

case 'P'://Found the second identifier ("p" airspeedindication)
Airspeed = "";
Airspeed += getChar();
Airspeed += getChar();
Airspeed += getChar();
int AirspeedInt = Airspeed.toInt(); // convert it to an integer (ThanksPhill)

if (AirspeedInt > 235) {digitalWrite(3, HIGH);} else{digitalWrite(3, LOW);} // turns on the flap LED indicating flaps selected butnot moved


void KEYS()
Kstringnewstate = "";
for (int KpinNo = 8; KpinNo < 13; KpinNo++){//check for inputs onpins 8 to 70
KpinStateSTR = String(digitalRead(KpinNo)); //if you change the 8 inthe line above ,, also change the 8 in the line below
KoldpinStateSTR = String(Kstringoldstate.charAt(KpinNo - );
if (KpinStateSTR != KoldpinStateSTR)//yes it's different
if (KpinNo != 13){ //pin 13 is no good as an input, it can"flutter" unless set up correctly
if (KpinNo == 8 && KpinStateSTR =="0"){Serial.println ("C15");} //flap handle up a bit
if (KpinNo == 9 && KpinStateSTR =="0"){Serial.println ("C14");} //flap handle down a bit
if (KpinNo > 9){//now the keys bit
Serial.print ("D");
if (KpinNo < 10) Serial.print ("0");
Serial.print (KpinNo);
Serial.println (KpinStateSTR);
}//end of keys bit
}//end of its not pin 13
}//end of yes its different
Kstringnewstate += KpinStateSTR;
}//end of 'For' loop

}//end of 'For' loop

A meny thanks to JiM NZ contobution to Arduno commuity I would not have been able to get this far in my build With out his work. Thank you Jim!