CoDrone Mini
  • ๐ŸŸก์†Œ๊ฐœํ•˜๊ธฐ
    • ๋™์˜์ƒ ๋งค๋‰ด์–ผ
    • ๋‹ค์šด๋กœ๋“œ์šฉ ์ž๋ฃŒ ๋ชจ์Œ
  • ์ฝ”๋“œ๋ก  ํŒŒ์ด์ฌ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
    • ๐Ÿ”ถํŒŒ์ด์ฌ
      • drone class
      • ping
      • information
      • pairing
      • control
      • sensor
      • buzzer
      • vibrator
      • light
      • display
      • input
      • error
    • ๐Ÿ”ทํ”„๋กœํ† ์ฝœ
      • Typedef
      • DataType
      • Definitions
      • Structs
      • Structs light
      • Structs display
      • Structs card
  • Site Link
    • ๐Ÿ’›Buy CoDrone Mini
    • ๐Ÿ’™ROBOLINK
Powered by GitBook
On this page
  • ๋ฒ„ํŠผ ์ž…๋ ฅ๊ฐ’ ์ถœ๋ ฅ
  • ์กฐ์ด์Šคํ‹ฑ ์ž…๋ ฅ๊ฐ’ ์ถœ๋ ฅ
  1. ์ฝ”๋“œ๋ก  ํŒŒ์ด์ฌ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
  2. ํŒŒ์ด์ฌ

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()
PreviousdisplayNexterror

Last updated 2 years ago

๐Ÿ”ถ