input
๋ฒํผ ์
๋ ฅ๊ฐ ์ถ๋ ฅ
from time import sleep
from e_drone.drone import *
from e_drone.protocol import *
def eventButton(button):
print("eventButton() / " +
"Button: 0b{0:16}, Event: {1:6}".format(bin(button.button)[2:].zfill(16), button.event.name))
if __name__ == '__main__':
drone = Drone()
drone.open()
# ์ด๋ฒคํธ ํธ๋ค๋ง ํจ์ ๋ฑ๋ก
drone.setEventHandler(DataType.Button, eventButton)
drone.sendPing(DeviceType.Controller)
for i in range(10, 0, -1):
print(i)
sleep(1)
drone.close()
์กฐ์ด์คํฑ ์
๋ ฅ๊ฐ ์ถ๋ ฅ
from time import sleep
from e_drone.drone import *
from e_drone.protocol import *
def eventJoystick(joystick):
print("eventJoystick() / " +
"L: ({0:4}, {1:4}), {2:5}, {3:5} / ".format(joystick.left.x, joystick.left.y, joystick.left.direction.name, joystick.left.event.name) +
"R: ({0:4}, {1:4}), {2:5}, {3:5}".format(joystick.right.x, joystick.right.y, joystick.right.direction.name, joystick.right.event.name))
if __name__ == '__main__':
drone = Drone()
drone.open()
# ์ด๋ฒคํธ ํธ๋ค๋ง ํจ์ ๋ฑ๋ก
drone.setEventHandler(DataType.Joystick, eventJoystick)
drone.sendPing(DeviceType.Controller)
for i in range(10, 0, -1):
print(i)
sleep(1)
drone.close()
Last updated