Created
January 16, 2013 00:41
-
-
Save mitchtech/4543601 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
import os | |
STEP = 100 | |
DELAY = 0.5 | |
def pwm(pin, angle): | |
print "servo[" + str(pin) + "][" + str(angle) + "]" | |
cmd = "echo " + str(pin) + "=" + str(angle) + " > /dev/servoblaster" | |
os.system(cmd) | |
time.sleep(DELAY) | |
while True: | |
for i in range(0, 8): | |
for j in range(1, 249, STEP): | |
pwm(i,j) | |
for i in range(0, 8): | |
for j in range(249, 1, (STEP*-1)): | |
pwm(i,j) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment