Skip to content

Instantly share code, notes, and snippets.

@tomvdb
Created November 6, 2017 12:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomvdb/251de94880ee6de8fe251955fbe4066c to your computer and use it in GitHub Desktop.
Save tomvdb/251de94880ee6de8fe251955fbe4066c to your computer and use it in GitHub Desktop.
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