changeset 9:129ac4eef472 default tip

Add comments to the code.
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sun, 07 Jun 2015 14:38:33 +0200
parents fbf9243c1444
children
files ubob.lua
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ubob.lua	Sun Jun 07 11:57:13 2015 +0200
+++ b/ubob.lua	Sun Jun 07 14:38:33 2015 +0200
@@ -1,3 +1,4 @@
+-- The poses of the walking animation.
 POSES = {
     {0, 10, 10},
     {15, 10, 10},
@@ -7,16 +8,21 @@
     {-15, 10, 10}
 }
 
+-- Current servo positions.
 sway_pos = 0
 left_pos = 0
 right_pos = 0
+
+-- Current pose.
 pose_step = 1
 
+-- Desired servo positions.
 sway = 0
 left = 0
 right = 0
 
 
+-- Initialize all pins and start walking.
 function start()
     pwm.setup(5, 60, 94)
     pwm.setup(6, 60, 88)
@@ -28,11 +34,15 @@
     gpio.write(2, 1)
 end
 
+
+-- Stop walking.
 function stop()
     tmr.stop(5)
     gpio.write(2, 0)
 end
 
+
+-- Move onto the next pose.
 function next_pose()
     local pose = 0
     pose_step = pose_step + 1
@@ -47,6 +57,7 @@
 end
 
 
+-- Update to the next frame of motion.
 function update()
     local moving = false
     if sway > sway_pos then
@@ -80,4 +91,5 @@
     end
 end
 
+-- Start walking when switched on.
 start()