is_upside_down() / isUpsideDown()

Description

This function checks whether the drone is upside-down and returns a boolean

Syntax

Python: is_upside_down()
Arduino: isUpsideDown()

Parameters

None

Returns

Boolean of whether the drone is upside-down

Example Code
Python
#Python code
import CoDrone

def main():
    drone = CoDrone.CoDrone()
    drone.pair()

    # takeoff when drone isn’t upside down
    if not drone.is_upside_down():
        drone.takeoff()

if __name__ == '__main__':
    main()
Arduino
//Arduino code
#include<CoDrone.h>     //header

void setup(){
    //open serial and connect
    CoDrone.begin(115200);
    CoDrone.pair(Nearest);

    if(CoDrone.isUpsideDown()==false)   // if drone is not upside down take off the drone
        CoDrone.takeoff();  
}

void loop(){

}