Skip to main content

is_flying()

Description#

This function checks whether the drone is flying and returns a boolean

Syntax#

Python: is_flying()
Arduino: isFlying()

Parameters#

None

Returns#

Boolean of whether the drone is flying

Example Code#
Python#
#Python code
import CoDrone
drone = CoDrone.CoDrone()
drone.pair()
drone.takeoff()
#land if flying.
if drone.is_flying():
drone.land()
drone.close()
Arduino#
//Arduino code
#include<CoDrone.h> //header
void setup(){
//open serial and connect
CoDrone.begin(115200);
CoDrone.pair(Nearest);
// If drone is flying land the drone
if(CoDrone.isFlying()==true)
CoDrone.land();
}
void loop(){
}