changeset 0:12992cf6cdd0

init
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Fri, 09 Jan 2015 00:03:32 +0100
parents
children aac66151e58e
files .hgignore ubob.lua
diffstat 2 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Fri Jan 09 00:03:32 2015 +0100
@@ -0,0 +1,16 @@
+syntax: glob
+*.pyc
+*~
+.*.swp
+docs/*
+build/*
+dist/*
+pygments/*
+werkzeug/*
+bin/*
+lib/*
+include/*
+local
+*.egg-info
+cache/*
+*.DS_Store
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ubob.lua	Fri Jan 09 00:03:32 2015 +0100
@@ -0,0 +1,36 @@
+function init()
+    pwm.setup(5, 60, 94)
+    pwm.setup(6, 60, 88)
+    pwm.setup(7, 60, 96)
+    pwm.start(5);
+    pwm.start(6);
+    pwm.start(7);
+end;
+
+function left_leg(position)
+    pwm.setduty(6, 88 + position);
+end;
+
+function right_leg(position)
+    pwm.setduty(5, 94 + position);
+end;
+
+function sway(position)
+    pwm.setduty(7, 96 + position);
+end;
+
+function left_step()
+    for pos = 0, 10 do
+        sway(pos);
+        tmr.delay(50000);
+    end;
+    for pos = 0, 10 do
+        left_leg(pos);
+        right_leg(pos);
+        tmr.delay(50000);
+    end;
+    for pos = 0, 10 do
+        sway(10 - pos);
+        tmr.delay(50000);
+    end;
+end;