目次
#contents
*はじめに [#x70dfc76]
*ロボットの説明 [#dd7d14cc]
#ref(DSC_0396.jpg)
*ロボットの動作・プログラミングの説明 [#h6098d3b]
 #!/usr/bin/python
 
 import ev3dev.ev3 as ev3
 import time
 
 motor_left = ev3.LargeMotor('outA')
 motor_right = ev3.LargeMotor('outB')
 motor_front = ev3.MediumMotor('outC')
 
 def forward(t,dl,dr):
         motor_left.run_forever(duty_cycle_sp=dl)
         motor_right.run_forever(duty_cycle_sp=dr)
         time.sleep(t/1000)
         motor_left.stop()
         motor_right.stop()
 
 def pen(t,df):
        motor_front.run_forever(duty_cycle_sp=df)
         time.sleep(t/1000)
         motor_front.stop()
 
 pen(1000,-38)
 time.sleep(2)
 forward(1000,-15,15)
 pen(1000,50)
 time.sleep(1)
 forward(1000,-12,-17)
 time.sleep(2)
 pen(1000,-38)
 time.sleep(2)
 forward(1000,-12,-12)
 time.sleep(1)
 forward(1000,-20,0)
 pen(1000,50)
 forward(2000,25,25)
 forward(1000,-26,26)
 forward(1000,-30,-30)
 pen(1000,-38)
 forward(1000,-15,-15)
 time.sleep(1)
 pen(1000,50)
 forward(1000,-15,-15)
 pen(1000,-38)
 forward(1000,-15,-15)
 time.sleep(1)
 pen(1000,50)
 forward(1000,35,35)
 pen(1000,-38)
 forward(1000,28,-36)
 time.sleep(1)
 forward(1000,-18,-25)
 pen(1000,50)
 forward(1000,0,90)
 time.sleep(1)
 forward(1000,-50,-50)
 pen(1000,-38)
 forward(1000,30,30)
 pen(1000,50)
 forward(1000,35,0)
 time.sleep(1)
 forward(1000,-17,-17)
 pen(1000,-38)
 forward(1000,-30,-30)
 time.sleep(1)
 pen(1000,50)
 forward(1000,-10,-10)
 time.sleep(1)
 forward(1000,0,-18)
 time.sleep(1)
 forward(1000,16,16)
 pen(1000,-38)
 forward(1000,20,20)
 pen(1000,50)
 forward(1000,-20,-20)
 time.sleep(1)
 forward(1000,-15,15)
 time.sleep(1)
 forward(1000,-20,-20)
 forward(1000,25,25)
 pen(1000,-38)
 time.sleep(1)
 forward(1000,25,25)
 pen(1000,50)
 forward(1000,-27,27)
 time.sleep(1)
 forward(1000,-18,-18)
 pen(1000,-38)
 forward(1000,-25,-25)
 time.sleep(1)
 pen(1000,50)
 forward(1000,15,-10)
 time.sleep(1)
 pen(1000,-38)
 forward(1000,18,18)
 time.sleep(1)
 pen(1000,50) 
 
 
 exit()
*顔を描く [#d8a83f97]
*感想・考察 [#u82222bd]

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS