Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Maze Controlled by Flick Shield on Raspberry PI
import maestro
import signal
import flicklib
xpos = 0
ypos = 0
@flicklib.move()
def move(x, y, z):
global xpos
global ypos
xpos = x
ypos = y
servo = maestro.Controller()
servo.setAccel(0,10)
servo.setAccel(1,10)
servo.setTarget(0, 6000)
servo.setTarget(1, 6000)
while True:
valuex = 0
valuex = (xpos * 100) - 50
valuey = 0
valuey = (ypos * 100) - 50
print str(valuex) + "," + str(valuey)
#print int(valuex)
if xpos > 0:
servo.setTarget(0, 6000+int(valuex*20))
servo.setTarget(1, 6000-int(valuey*20))
signal.pause()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment