Created
June 19, 2021 14:58
-
-
Save youngsoul/4ad85575095987e0ea7c0e0357cc3070 to your computer and use it in GitHub Desktop.
Script to fly the Tello to test installation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from djitellopy import Tello | |
import time | |
tello = Tello() | |
tello.connect() | |
time.sleep(2) | |
response = tello.get_battery() | |
print(response) | |
time.sleep(2) | |
tello.takeoff() | |
time.sleep(2) | |
tello.move_up(40) | |
time.sleep(2) | |
tello.move_down(40) | |
time.sleep(2) | |
# Create a loop to go up and down 3 times | |
# range(0,4) - produces the numbers 0,1,2,3. It is said to be exclusive of the last number 4. | |
print(f"Height: {tello.get_height()}") | |
for i in range(0,4): | |
print("Move Up") | |
tello.move_up(40) | |
print(f"Height: {tello.get_height()}") | |
print("Move Down") | |
tello.move_down(40) | |
print(f"Height: {tello.get_height()}") | |
time.sleep(2) | |
tello.move_left(30) | |
time.sleep(2) | |
tello.move_back(30) | |
time.sleep(2) | |
tello.rotate_clockwise(180) | |
time.sleep(2) | |
tello.rotate_counter_clockwise(180) | |
time.sleep(2) | |
result = tello.get_battery() | |
print(result) | |
time.sleep(2) | |
result=tello.get_flight_time() | |
print(result) | |
time.sleep(2) | |
result=tello.get_temperature() | |
print(result) | |
time.sleep(2) | |
tello.land() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment