diff options
author | Jure Žabkar <jure.zabkar@fri.uni-lj.si> | 2015-10-13 12:24:41 +0200 |
---|---|---|
committer | Jure Žabkar <jure.zabkar@fri.uni-lj.si> | 2015-10-13 12:24:41 +0200 |
commit | 1e5d42ba53ea0c631dbc6f21887839c91571ebca (patch) | |
tree | b6893cba081afc1badcf5864be68333ecf0ef82c /robot/problems/introduction/spotturn90/naloga03_turnOnSpotRight90.py | |
parent | 0a88716110994f789f764704a96791fdfb5fa288 (diff) |
Uvodne vaje za robotiko
Diffstat (limited to 'robot/problems/introduction/spotturn90/naloga03_turnOnSpotRight90.py')
-rw-r--r-- | robot/problems/introduction/spotturn90/naloga03_turnOnSpotRight90.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/robot/problems/introduction/spotturn90/naloga03_turnOnSpotRight90.py b/robot/problems/introduction/spotturn90/naloga03_turnOnSpotRight90.py new file mode 100644 index 0000000..033290b --- /dev/null +++ b/robot/problems/introduction/spotturn90/naloga03_turnOnSpotRight90.py @@ -0,0 +1,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 |