Skip to content

Instantly share code, notes, and snippets.

@mitchtech
Created January 16, 2013 00:41
Show Gist options
  • Save mitchtech/4543601 to your computer and use it in GitHub Desktop.
Save mitchtech/4543601 to your computer and use it in GitHub Desktop.
#!/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