here is the entire code
airspeed is a string that's converted to a float.
#include <Arduino.h>
// Motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step
#define MOTOR_STEPS 12.5
// Target RPM for cruise speed
#define RPM 100
// Acceleration and deceleration values are always in FULL steps / s^2
#define MOTOR_ACCEL 50
#define MOTOR_DECEL 50
// Microstepping mode. If you hardwired it to save pins, set to the same value here.
#define MICROSTEPS 16
#define DIR 2
#define STEP 3
#define ENABLE 13 // optional (just delete ENABLE from everywhere if not used)
#include "A4988.h"
#define MS1 10
#define MS2 11
#define MS3 12
A4988 stepper(MOTOR_STEPS, DIR, STEP, ENABLE, MS1, MS2, MS3);
int CodeIn;// used on all serial reads
int KpinNo;
int Koutpin;
String KoldpinStateSTR, KpinStateSTR, Kstringnewstate,Kstringoldstate;
String gearSimple;
float a = 0;
float a2;
String airspeed;
float oldas = 0;
int b;
void setup()
{
 Kstringoldstate = "111111111111111111111111111111111111111111111111111111111111111111111";
Â
 for (int KoutPin = 8; KoutPin < 70; KoutPin++)// Get all the pins ready for simconnect codes and "Keys"(all inputs)Â
 {
  pinMode(KoutPin, INPUT);
  digitalWrite(KoutPin, HIGH);Â
 }
Â
Serial.begin(115200);Â
stepper.begin(RPM, MICROSTEPS);
stepper.enable();
stepper.setSpeedProfile(stepper.LINEAR_SPEED, MOTOR_ACCEL, MOTOR_DECEL);
}
void loop() {
 {INPUTS();} //Check the Simconnect and "keys" section for any input pins
 {OTHER();}// Check for "Other" things to do. (Non extraction stuff)
 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)
 }
} // end of void loop (The main one)
char getChar()// Get a character from the serial buffer
{
 while(Serial.available() == 0);// wait for data
 return((char)Serial.read());// Thanks Doug
}// end of getchar void.
void OTHER(){
/* In here you would put code that uses other data that
cant be put into an "extraction void" that references something else.
Also in here you would put code to do something that was not
relying on a current extraction trigger.
Or ,, you could just put it all in the main "void loop" and not worry about this "other void" at all.
*/
}// end of "other" void
void EQUALS(){Â Â Â // The first identifier was "="
CodeIn = getChar(); // Get the second identifier
 switch(CodeIn) {// Now lets find what to do with it
 Â
  case 'B':
   //Do something
  break;
 Â
    //etc etc etc
  }
}// end of equals loop
void LESSTHAN(){Â Â // The first identifier was "<"
CodeIn = getChar(); // Get the second identifier
 switch(CodeIn) {// Now lets find what to do with it
 case 'P'://The second identifier was an "A"
 {
  airspeed = "";
  airspeed += getChar();
  airspeed += getChar();
  airspeed += getChar();
  a = airspeed.toFloat();
  a2 = a * 3.9; Â
  if (a2 != oldas)
  {
   b = oldas - a2;
   stepper.rotate(b);
   oldas = a2;
  }
 }
 break;
 case 'A'://The second identifier was an "A"
   {
   Â
   }
  break;
 Â
  case 'B':
   //Do something
  break;
   //etc etc etc
  }
}// end of lessthan void
void QUESTION(){Â Â // The first identifier was "?"
CodeIn = getChar(); // Get the second identifier
 switch(CodeIn) {// Now lets find what to do with it
  case 'A'://The second identifier was an "A"
   //Do something
  break;
 Â
  case 'B':
   //Do something
  break;
 Â
  case 'Y': // found the second identifier (the "Gear simple")
  break;
    //etc etc etc
  }
}// end of question void
void SLASH(){Â Â // The first identifier was "/" (Annunciator)
 //Do something (See the other voids for layout)
} // end of slash void
void INPUTS() // Simconnect codes and "Keys" section
{
 Kstringnewstate = "";
 for (int KpinNo = 8; KpinNo < 70; KpinNo++){ //set to the input pins. (pins 8 to 70 ,, change the 70 to 19 for Uno cards)
  KpinStateSTR = String(digitalRead(KpinNo));
  KoldpinStateSTR = String(Kstringoldstate.charAt(KpinNo - 8));// set to the first pin read (The 8)
  if (KpinStateSTR != KoldpinStateSTR)// checks if it's different to the last reading of that pinNo
  {
   if (KpinNo != 13){ // avoid using pin 13 as an input unless you know the tricks.
    if (KpinNo == 8 && KpinStateSTR == "0"){Serial.println ("C01");} //sets gear handle up
    if (KpinNo == 9 && KpinStateSTR == "0"){Serial.println ("C02");} //sets gear handle down
    if (KpinNo == 10 && KpinStateSTR == "0"){Serial.println ("C15");} //Decrements flap handle position
    if (KpinNo == 11 && KpinStateSTR == "0"){Serial.println ("C14");} //Increments flap handle position
    if (KpinNo == 12 && KpinStateSTR == "0"){Serial.println ("A02");} //Increments COM1sb by one MHz
    if (KpinNo == 14 && KpinStateSTR == "0"){Serial.println ("A01");} //Decrements COM1sb by one MHz
    if (KpinNo == 15 && KpinStateSTR == "0"){Serial.println ("A426543");} //Sets transponder code to 6543
    // Add more here but remember to change the figure in the next line down. (the 15)
    if (KpinNo > 15){ //Change pinNo number to same as the highest one used for simconnect codes.(the 15)
    Serial.print ("D");
   if (KpinNo < 10) Serial.print ("0");
   Serial.print (KpinNo);
   Serial.println (KpinStateSTR);
    }//end of 'its pinNo is greater than 12'
   }//end of 'its not pin 13'
  }//end of 'its different'  Â
  Kstringnewstate += KpinStateSTR;
 }//end of 'for' loop (read the pins)
 Kstringoldstate = Kstringnewstate;
}//end of INPUTS void