I'm wondering what's wrong with this? I used some example code for a flaps servo and changed it to RPM. I thought I replicated it well but whats up with it?



There errors:

Multi_Keys_with_flaps_servo.ino: In function 'void LESSTHAN()':
Multi_Keys_with_flaps_servo.ino:104:10: error: jump to case label [-fpermissive]
Multi_Keys_with_flaps_servo.ino:97:11: error: crosses initialization of 'int rpmi'
Error compiling.

And the code:

#include
Servo flapsServo;
Servo rpmServo;








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


String KoldpinStateSTR, KpinStateSTR, Kstringnewstate,Kstringoldstate;


void setup()
{
Kstringoldstate = "111111111111111111111111111111111111111111111111111111111111111111111";

for (int KoutPin = 2; KoutPin < 70; KoutPin++)// Get all the pins ready for "Keys"
{
pinMode(KoutPin, INPUT);
digitalWrite(KoutPin, HIGH);
}
Serial.begin(115200);
pinMode(13, OUTPUT);// For the servo.
pinMode(12, OUTPUT);

flapsServo.attach(13);
rpmServo.attach(12);


}


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


}


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


void EQUALS(){ // The first identifier was "="
CodeIn = getChar(); // Get another character
switch(CodeIn) {// Now lets find what to do with it
case 'A'://Found the second identifier
//Do something
break;

case 'B':
//Do something
break;

case 'C':
//Do something
break;
}
}


void LESSTHAN(){ // The first identifier was "<"
CodeIn = getChar(); // Get another character
switch(CodeIn) {// Now lets find what to do with it
case 'A'://Found the second identifier
//Do something
break;

case 'T':
rpm = "";
rpm += getChar();
rpm += getChar();
rpm += getChar();
int rpmi = rpm.toInt(); // convert it to an integer (Thanks Phill)
rpmi = (rpmi + 10);// Manual correction to suit servo zero.
rpmServo.write(rpmi * 10); // Manual fiddle to get full span of servo.
// Note.. Using the "Map" method slows it down.
//Serial.print(flapsi); // Used for testing
break;

case 'U'://Found the second identifier ("G" Flaps position)
flaps = "";
flaps += getChar();
flaps += getChar();
flaps += getChar();
int flapsi = flaps.toInt(); // convert it to an integer (Thanks Phill)
flapsi = (flapsi + 10);// Manual correction to suit servo zero.
flapsServo.write(flapsi * 10); // Manual fiddle to get full span of servo.
// Note.. Using the "Map" method slows it down.
//Serial.print(flapsi); // Used for testing
break;
}
}


void QUESTION(){ // The first identifier was "?"
CodeIn = getChar(); // Get another character
switch(CodeIn) {// Now lets find what to do with it
case 'A'://Found the second identifier
//Do something
break;

case 'B':
//Do something
break;

case 'C':
//Do something
break;
}
}
void SLASH(){ // The first identifier was "/" (Annunciator)
//Do something
}
void KEYS()
{
Kstringnewstate = "";
for (int KpinNo = 2; KpinNo < 70; KpinNo++){
KpinStateSTR = String(digitalRead(KpinNo));
KoldpinStateSTR = String(Kstringoldstate.charAt(KpinNo - 2));
if (KpinStateSTR != KoldpinStateSTR)
{
if (KpinNo != 13){
Serial.print ("D");
if (KpinNo < 10) Serial.print ("0");
Serial.print (KpinNo);
Serial.println (KpinStateSTR);
}
}
Kstringnewstate += KpinStateSTR;
}
Kstringoldstate = Kstringnewstate;
}



Thanks!