# data[].attributes.body
from time import sleep

import keyboard

from CodingRider.drone import *

from CodingRider.protocol import *

drone1 = Drone()

drone2 = Drone()

drone3 = Drone()

drone1.open('COM3')

drone2.open('COM4')

drone3.open('COM5')

while True:

if keyboard.is_pressed('enter'):

print('이륙')

sleep(2)

drone1.sendTakeOff()

drone2.sendTakeOff()

drone3.sendTakeOff()

sleep(5)

print('이륙 완료')

if keyboard.is_pressed('space'):

print('착륙')

drone1.sendControlWhile(0, 0, 0, 0, 500)

drone2.sendControlWhile(0, 0, 0, 0, 500)

drone3.sendControlWhile(0, 0, 0, 0, 500)

drone1.sendLanding()

drone2.sendLanding()

drone3.sendLanding()

sleep(3)

print('착륙 완료')

if keyboard.is_pressed('esc'):

print('프로그램 종료')

break

if keyboard.is_pressed('up'):

drone1.sendControlPosition(1, 0, 0, 1, 0, 0)

drone2.sendControlPosition(1, 0, 0, 1, 0, 0)

drone3.sendControlPosition(1, 0, 0, 1, 0, 0)

sleep(2)

if keyboard.is_pressed('down'):

drone1.sendControlPosition(-1, 0, 0, 1, 0, 0)

drone2.sendControlPosition(-1, 0, 0, 1, 0, 0)

drone3.sendControlPosition(-1, 0, 0, 1, 0, 0)

sleep(2)

if keyboard.is_pressed('left'):

drone1.sendControlPosition(0, 1, 0, 1, 0, 0)

drone2.sendControlPosition(0, 1, 0, 1, 0, 0)

drone3.sendControlPosition(0, 1, 0, 1, 0, 0)

sleep(2)

if keyboard.is_pressed('right'):

drone1.sendControlPosition(0, -1, 0, 1, 0, 0)

drone2.sendControlPosition(0, -1, 0, 1, 0, 0)

drone3.sendControlPosition(0, -1, 0, 1, 0, 0)

sleep(2)

if keyboard.is_pressed('c'):

drone1.sendControlPosition(0, 0, 0, 0, 360, 360)

drone2.sendControlPosition(0, 0, 0, 0, 360, 360)

drone3.sendControlPosition(0, 0, 0, 0, 360, 360)

sleep(2)

# data[].attributes.body
from time import sleep

from CodingRider.drone import *

from CodingRider.protocol import *

drone1 = Drone()

drone2 = Drone()

drone3 = Drone()

drone1.open('COM3')

drone2.open('COM4')

drone3.open('COM5')

# LED 색을 바꿉니다.

drone1.sendLightModeColor(LightModeDrone.BodyHold, 255, 255, 0, 0)

drone2.sendLightModeColor(LightModeDrone.BodyHold, 255, 0, 255, 0)

drone3.sendLightModeColor(LightModeDrone.BodyHold, 255, 0, 0, 255)

# 동시에 이륙하고 착륙합니다.

sleep(2)

drone1.sendTakeOff()

drone2.sendTakeOff()

drone3.sendTakeOff()

sleep(5)

drone1.sendLanding()

drone2.sendLanding()

drone3.sendLanding()

# data[].attributes.body
from time import sleep

import keyboard

from CodingRider.drone import *

from CodingRider.protocol import *

drone = Drone()

drone.open('COM5')

speed = 50

while True:

if keyboard.is_pressed('enter'):

print('이륙')

sleep(2)

drone.sendTakeOff()

sleep(5)

print('이륙 완료')

if keyboard.is_pressed('space'):

print('착륙')

drone.sendControlWhile(0, 0, 0, 0, 500)

drone.sendLanding()

sleep(3)

print('착륙 완료')

if keyboard.is_pressed('q'):

print('정지')

drone.sendControlWhile(0, 0, 0, 0, 500)

drone.sendStop()

sleep(3)

if keyboard.is_pressed('esc'):

print('프로그램 종료')

break

if keyboard.is_pressed('up'):

while keyboard.is_pressed('up'):

drone.sendControl(0, speed, 0, 0)

drone.sendControl(0, 0, 0, 0)

if keyboard.is_pressed('down'):

while keyboard.is_pressed('down'):

drone.sendControl(0, -speed, 0, 0)

drone.sendControl(0, 0, 0, 0)

if keyboard.is_pressed('left'):

while keyboard.is_pressed('left'):

drone.sendControl(-speed, 0, 0, 0)

drone.sendControl(0, 0, 0, 0)

if keyboard.is_pressed('right'):

while keyboard.is_pressed('right'):

drone.sendControl(speed, 0, 0, 0)

drone.sendControl(0, 0, 0, 0)

if keyboard.is_pressed('w'):

while keyboard.is_pressed('w'):

drone.sendControl(0, 0, 0, speed)

drone.sendControl(0, 0, 0, 0)

if keyboard.is_pressed('s'):

while keyboard.is_pressed('s'):

drone.sendControl(0, 0, 0, -speed)

drone.sendControl(0, 0, 0, 0)

if keyboard.is_pressed('a'):

while keyboard.is_pressed('a'):

drone.sendControl(0, 0, speed, 0)

drone.sendControl(0, 0, 0, 0)

if keyboard.is_pressed('d'):

while keyboard.is_pressed('d'):

drone.sendControl(0, 0, -speed, 0)

drone.sendControl(0, 0, 0, 0)

sleep(0.01)

# data[].attributes.body
from time import *

import keyboard

while True:

print(keyboard.read_key())

sleep(0.01)

if keyboard.read_key() == 'esc':

print('프로그램 종료')

break

# data[].attributes.body
from time import sleep

from CodingRider.drone import *

from CodingRider.protocol import *

drone = Drone()

drone.open('COM5')

sleep(2)

drone.sendTakeOff()

sleep(5)

drone.sendControlWhile(0, 30, 0, 0, 1000)

drone.sendControlWhile(30, 0, 0, 0, 1000)

drone.sendControlWhile(0, -30, 0, 0, 1000)

drone.sendControlWhile(-30, 0, 0, 0, 1000)

sleep(2)

drone.sendLanding()

# data[].attributes.body
from time import sleep

from CodingRider.drone import *

from CodingRider.protocol import *

drone = Drone()

drone.open('COM5')

sleep(2)

drone.sendTakeOff()

sleep(5)

drone.sendControl(0, 50, 0, 0)

sleep(3)

drone.sendLanding()

# data[].attributes.body
from time import sleep

from CodingRider.drone import *

from CodingRider.protocol import *

drone = Drone()

drone.open('COM5') # 포트 열기

drone.sendClearBias() # 드론 초기화

sleep(1)

# 이착륙 시퀀스

sleep(2)

drone.sendTakeOff()

sleep(5)

drone.sendLanding()

# data[].attributes.body
from CodingRider.drone import *

from CodingRider.protocol import *

drone = Drone()

drone.open('COM5')

#자신의 포트번호와 일치하는지 확인 후, 다르다면 변경

drone.sendBuzzerScale(BuzzerScale.C4, 500)