Self Test Code

Hi,

I'm not 100% if this belongs in here or Programming Questions so apologies if it's in the wrong place..

Basically I have built a drone and I would like the arduino to alert me if one of the sensors isn't working, I forgot to connect the IMU today and none of the code ran, this was a pretty obvious fix but in future it would be nice to get a visual alert if something wasn't right on the arduino before attempting to fly it.

The code roughly looks like this

void setup(){
Init_IMU();
Init_Mpu6050();
Init_Baro():
Other_Stuff();
}

void loop(){
Get_IMU_Data();    //MPU6050
Get_Alt_Data();      //BMP280
Do_Some_Calcs();  //maths stuff
}

void Interrupt_routine(){    //Reads PWM values from a 6h Rx via PPM
...}

Is there an elegant/simple way to do some sort of test of the MPU6050/BMP280/PPM values to see if they are all receiving data and notify the user through something simple like a red fail LED. Maybe they all need a self check in the setup and unless they are all working the fail LED turns on, or doesn't turn off if it is written high before the setup code.

Libraries for many of those sensors have initialization routines that return a value indicating whether the device responds properly. It is a good idea to check those return values.