information
์กฐ์ข
๊ธฐ์ ํ์จ์ด ์ ๋ณด ์์ฒญ
from time import sleep
from e_drone.drone import *
from e_drone.protocol import *
if __name__ == '__main__':
drone = Drone(False)
drone.open()
drone.sendRequest(DeviceType.Controller, DataType.Information)
timeStart = time.time()
while True:
sleep(0.01)
dataType = drone.check()
if dataType == DataType.Information:
information = drone.getData(DataType.Information)
print("ModeUpdate: {0}".format(information.modeUpdate))
print("ModelNumber: {0}".format(information.modelNumber))
print("Version: {0}.{1}.{2} / {3} / 0x{3:08X}".format(
information.version.major,
information.version.minor,
information.version.build,
information.version.v))
print("Release Date: {0}.{1}.{2}".format(
information.year,
information.month,
information.day))
break
if time.time() > timeStart + 1:
break
drone.close()
์กฐ์ข
๊ธฐ์ ํ์จ์ด ์ ๋ณด ์์ฒญ(์ด๋ฒคํธ ํจ์ ๋ฑ๋ก)
# ์กฐ์ข
๊ธฐ์ ํ์จ์ด ์ ๋ณด๋ฅผ ์์ฒญํ๊ณ , ์ด๋ฒคํธ ํธ๋ค๋ฌ๋ฅผ ํตํด ์๋ต์ ์ถ๋ ฅํ๋ ์์
from time import sleep
from e_drone.drone import *
from e_drone.protocol import *
def eventInformation(information):
print("eventInformation()")
print("ModeUpdate: {0}".format(information.modeUpdate))
print("ModelNumber: {0}".format(information.modelNumber))
print("Version: {0}.{1}.{2} / {3} / 0x{3:08X}".format(
information.version.major,
information.version.minor,
information.version.build,
information.version.v))
print("Release Date: {0}.{1}.{2}".format(
information.year,
information.month,
information.day))
if __name__ == '__main__':
drone = Drone()
drone.open()
# ์ด๋ฒคํธ ํธ๋ค๋ง ํจ์ ๋ฑ๋ก
drone.setEventHandler(DataType.Information, eventInformation)
# Information ์ ๋ณด ์์ฒญ
drone.sendRequest(DeviceType.Controller, DataType.Information)
sleep(0.1)
drone.close()
Last updated