Skip to content

Instantly share code, notes, and snippets.

@jonwitts
Created January 26, 2018 22:40
Show Gist options
  • Save jonwitts/ec3fcf9bd93a2a6c1acbc58f63aa4668 to your computer and use it in GitHub Desktop.
Save jonwitts/ec3fcf9bd93a2a6c1acbc58f63aa4668 to your computer and use it in GitHub Desktop.
Code for the CamJamEduKit3 Robot controlled using the BlueDot Android app
#!/usr/bin/python3
from bluedot import BlueDot
from gpiozero import CamJamKitRobot, LED
from signal import pause
bd = BlueDot()
robot = CamJamKitRobot()
blue = LED(24)
red = LED(23)
def move(pos):
if pos.top:
robot.backward(pos.distance)
blue.on()
elif pos.bottom:
robot.forward(pos.distance)
red.on()
elif pos.left:
robot.left(pos.distance)
blue.on()
elif pos.right:
robot.right(pos.distance)
blue.on()
def stop() :
robot.stop ()
red.off()
blue.off()
bd.when_pressed = move
bd.when_moved = move
bd.when_released = stop
pause ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment