summaryrefslogtreecommitdiff
path: root/robot/problems/introduction/spotturn90/naloga03_turnOnSpotRight90.py
diff options
context:
space:
mode:
Diffstat (limited to 'robot/problems/introduction/spotturn90/naloga03_turnOnSpotRight90.py')
-rw-r--r--robot/problems/introduction/spotturn90/naloga03_turnOnSpotRight90.py23
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