五芒星を描く2 | kazenokinositaのブログ

kazenokinositaのブログ

Telloは少しお休みで、pythonそしてPearOSとたわむれてます

繰り返しをつかって(forloop)

 

<pentaguram_forloop.py>

 

from djitellopy import Tello #これが肝ですね

import time                                 #sleep用 ホバリングはない模様

print("テローのオブジェクトを作ります")

tello = Tello()

print("テローにつなげます")

tello.connect()

print("りりく!")

tello.takeoff()

 

print("18度向きを変える”)

tello.rotate_counter_clockwise(18)

 

print("5回ループ”)

for num in range(5):            #pythonは字下げが大事

       print("300cmの星の一辺”)

       tello.move_forward(300)

       print("144度向きを変える”)

       tello.rotate_counter_clockwise(144)

       
tello.land()

print("touchdown.... goodbye")