File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1-
2-
31import pygame
4- from pygame .locals import *
2+ from pygame .locals import *
53import time
6- from djitellopy import Tello
4+
75
86pygame .JOYBUTTONDOWN
97
1513# Initialize the joysticks.
1614pygame .joystick .init ()
1715
18- tello = Tello ()
19- tello .connect ()
20- time .sleep (3 )
21- tello .takeoff ()
2216
2317# -------- Main Program Loop -----------
2418while not done :
19+
2520 # Get count of joysticks.
2621 joystick_count = pygame .joystick .get_count ()
2722
4338 done = True
4439 quit ()
4540 if event .button == 6 :
46- tello .takeoff ()
47- if event .button == 7 :
48- tello .land ()
41+ print ("start has been pressed" )
4942
43+ if event .button == 7 :
44+ print ("select has been pressed" )
5045 if event .type == JOYAXISMOTION :
5146 if (joystick .get_axis (0 ) > 0.5 ) or (joystick .get_axis (0 ) < - 0.5 ):
5247 print ("left thumbstock is moving left and right" )
You can’t perform that action at this time.
0 commit comments