Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pynxc/tutorial_samples/2_repeat_c.py
diff options
context:
space:
mode:
Diffstat (limited to 'pynxc/tutorial_samples/2_repeat_c.py')
-rw-r--r--pynxc/tutorial_samples/2_repeat_c.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/pynxc/tutorial_samples/2_repeat_c.py b/pynxc/tutorial_samples/2_repeat_c.py
new file mode 100644
index 0000000..a9988c4
--- /dev/null
+++ b/pynxc/tutorial_samples/2_repeat_c.py
@@ -0,0 +1,23 @@
+# 10 SQUARES
+#
+#This program make the robot run 10 squares
+#
+#
+
+# Time for a straight move
+DEFINE MOVE_TIME=500
+# Time for turning 90 degrees
+DEFINE TURN_TIME=360
+
+def main():
+
+ for repeat in range(10): # Make 10 squares
+ for repeat in range(4):
+
+ OnFwd(OUT_AC, 75)
+ Wait(MOVE_TIME)
+ OnRev(OUT_C, 75)
+ Wait(TURN_TIME)
+
+ Off(OUT_AC) # Now turn the motors off
+