<commit_before>**[*petrone_v2* for python](index.md)** / **Examples** / **Control**

Modified : 2018.3.5

---

<br>


## <a name="ControlWhileAndLanding">이륙, 호버링, 착륙 테스트</a>

```py
from time import sleep

from petrone_v2.drone import *
from petrone_v2.protocol import *


if __name__ == '__main__':

    drone = Drone()
    drone.open("COM22")

    print("TakeOff")
    drone.sendTakeOff()
    for i in range(2, 0, -1):
        print("{0}".format(i))
        sleep(1)

    print("Hovering")
    for i in range(5, 0, -1):
        print("{0}".format(i))
        drone.sendControlWhile(0, 0, 0, 0, 1000)
        sleep(0.01)

    print("Landing")
    dataArray = drone.sendLanding()
    sleep(0.01)

    drone.close()
```

- [sendTakeOff()](04_drone.md#sendTakeOff)
- [sendControlWhile()](04_drone.md#sendControlWhile)
- [sendLanding()](04_drone.md#sendLanding)


<br>
<br>


## <a name="ControlWhile">이륙, 조종, 정지 테스트</a>

```py
from time import sleep

from petrone_v2.drone import *
from petrone_v2.protocol import *


if __name__ == '__main__':

    drone = Drone()
    drone.open("COM22")

    print("TakeOff")<commit_msg>페트론 V2 파이썬 비행 예제 수정<commit_after>**[*petrone_v2* for python](index.md)** / **Examples** / **Control**

Modified : 2018.7.24

---

<br>


## <a name="ControlWhileAndLanding">이륙, 호버링, 착륙 테스트</a>

```py
from time import sleep

from petrone_v2.drone import *
from petrone_v2.protocol import *


if __name__ == '__main__':

    drone = Drone()
    drone.open()

    print("TakeOff")
    drone.sendTakeOff()
    for i in range(3, 0, -1):
        print("{0}".format(i))
        sleep(1)

    print("Hovering")
    for i in range(5, 0, -1):
        print("{0}".format(i))
        drone.sendControlWhile(0, 0, 0, 0, 1000)
        sleep(0.01)

    print("Landing")
    drone.sendLanding()
    for i in range(5, 0, -1):
        print("{0}".format(i))
        sleep(1)

    drone.close()
```

- [sendTakeOff()](04_drone.md#sendTakeOff)
- [sendControlWhile()](04_drone.md#sendControlWhile)
- [sendLanding()](04_drone.md#sendLanding)


<br>
<br>


## <a name="ControlWhile">이륙, 조종, 정지 테스트</a>

```py
from time import sleep

from petrone_v2.drone import *
from petrone_v2.protocol import *


if __name__ == '__main__':

    drone = Drone()
    drone.open("COM22")

    print("TakeOff")
{'fraction_non_alphanumeric': 0.18034934497816593, 'fraction_numerical': 0.039301310043668124, 'mean_word_length': 3.2113970588235294, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7593313', 'n_tokens_mistral': 1042, 'n_tokens_neox': 988, 'n_words': 184}