summaryrefslogtreecommitdiff
path: root/robot/problems/introduction/gyro90/naloga07_gyro90.py
blob: 84d4ca1454f4a0b91d958779f79bfc03cd7f8f30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
# coding=utf-8

print ("""
Naloga 7:
   Robot naj se na mestu obrne za 90 stopinj v desno; pri tem naj si pomaga z ziroskopom.
""")
import sys
sys.path.append('/home/user/codeq')
from ev3dev import *
from mindstorms_widgets import mindstorms_widgets

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

robot.gyro_set_mode( 'angle' )
robot.reset_gyro()

power = 15
robot.move_tank( 'on', lr_power=[power,-power] )
while robot.gyro_sensor_measure() < 90:
    pass
robot.move_tank( 'off' )