go()

Description

A simpler Junior level function that represents positive flight with a direction, but with more natural language.
It simply flies in the given direction for the given duration and power.

Syntax

go(direction)
go(direction, duration)
go(direction, duration, power)

Parameters

direction: a constant in Arduino and enum in Python. It’s the direction of the flight, which can be one of the following: FORWARD, BACKWARD, LEFT, RIGHT, UP, and DOWN.
duration: the duration of the flight motion in seconds. If undefined, defaults to 1 seconds. If duration is 0, it will turn right indefinitely.
power: the power at which the drone flies forward. Takes a value from 0 to 100. Defaults to 50 if not defined.

Returns

None

Example Code
Python
#Python code
import CoDrone
from CoDrone import Direction

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

    drone.go(Direction.FORWARD)         # Go forward for 1 second at 50% power
    drone.go(Direction.UP, 5)           # Go up for 5 seconds at 50% power
    drone.go(Direction.BACKWARD, 3, 70) # Go backwards for 3 seconds at 70% power

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

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

    CoDrone.takeoff();
    CoDrone.go(FORWARD);        // Go forward at 50% power for 1 second
    CoDrone.go(UP, 5);          // Go up for 5 seconds at 50% power
    CoDrone.go(BACKWARD, 3, 70) // Go backwards for 3 seconds at 70% power  
}

void loop(){

}