Skip to content

Instantly share code, notes, and snippets.

@youngsoul
Created June 19, 2021 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youngsoul/4ad85575095987e0ea7c0e0357cc3070 to your computer and use it in GitHub Desktop.
Save youngsoul/4ad85575095987e0ea7c0e0357cc3070 to your computer and use it in GitHub Desktop.
Script to fly the Tello to test installation
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