Using BMP280 sensor to control servos. Need some guidance with coding

Hi Martin,

Wow! Thanks for introducing this State Machine idea to me. It looks so neat! I like how each phrase is completed and then move to the next phrase, and I would like to use this for my project if I could. However, as a new learner in Arduino programming, I have encountered some questions while trying it out, like for example:
How do I turn this whole chunk

Serial.begin(115200);                           // Initialise the serial port
  bmp280.begin();                                 // Default initialisation, place the BMP280 into SLEEP_MODE 
  //bmp280.setPresOversampling(OVERSAMPLING_X4);    // Set the pressure oversampling to X4
  //bmp280.setTempOversampling(OVERSAMPLING_X1);    // Set the temperature oversampling to X1
  //bmp280.setIIRFilter(IIR_FILTER_4);              // Set the IIR filter to setting 4
  bmp280.setTimeStandby(TIME_STANDBY_125MS);     // Set the standby time to 125 milliseconds
  bmp280.startNormalConversion();                 // Start BMP280 continuous conversion in NORMAL_MODE

into a simple function initialiseBarometer(); ?

Also, in these two missions below for instance, is it the right way to interpret how the State Machine works (please see the comments that I made) ?
The example code that you provided above is so clean and nice, and I am trying to work toward that.

case DISARMED:
     armedInput = (digitalRead(pushButton)==LOW);  //to initiate the system by pressing a push button?
     if (armedInput == true)
{
stateMachine = ARMED;
}
break;
case ARMED:
      launchInput = readLaunchInput();  //What is this supposed to be?
      launchSiteAltitude = bmp280 (); //is this how to readBarometerAltitude?
      if (launchInput == true)
      {        
        stateMachine == LAUNCH;
      }
      break;

Thanks again for the information :raised_hands: :smiley: