summaryrefslogtreecommitdiff
path: root/robot/problems/introduction/spotturn90/naloga03_turnOnSpotRight90.py
blob: 033290ba3b412b5d79c67f806296a66b78a92986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/python

print ("Robot naj se na mestu obrne za 90 stopinj v desno.")
import sys
sys.path.append('/home/user/codeq')
import time
from ev3dev import *
from mindstorms_widgets import mindstorms_widgets

robot = mindstorms_widgets()
robot.connect_motor( 'left' )
robot.connect_motor( 'right' )

# Solution 1:
#robot.move_tank( 'on_for_seconds', lr_power=[20,-20], seconds=.9 )
 
# Solution 2:
robot.motor['left'].position = 0
robot.motor['right'].position = 0
while robot.motor['left'].position <180 or robot.motor['right'].position <180:
    robot.large_motor( 'left', 'on', power=10 )
    robot.large_motor( 'right', 'on', power=10 , invert=True)
    #print robot.motor['left'].position, robot.motor['right'].position