Skip to content

Instantly share code, notes, and snippets.

@erica
Created December 12, 2016 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erica/bbda9280cacdd3ef24621f66cc9d3faa to your computer and use it in GitHub Desktop.
Save erica/bbda9280cacdd3ef24621f66cc9d3faa to your computer and use it in GitHub Desktop.
import sys
import cozmo
from Cozmo import *
from Colors import *
# run, cozmo, run
def actions(cozmoLink):
'''Specify actions for cozmo to run.'''
# Fetch robot
coz = Cozmo.robot(cozmoLink)
# Say something
coz.say("Hello")
# Drive a little
coz.drive(time = 3, direction = Direction.forward)
# Turn
coz.turn(degrees = 180)
# Drive a little more
coz.drive(time = 3, direction = Direction.forward)
# Light up a cube
cube = coz.cube(0)
cube.setColor(colorLime)
# Tap it!
coz.say("Tap it")
if cube.waitForTap():
coz.say("You tapped it")
else:
coz.say("Why no tap?")
cube.switchOff()
Cozmo.startUp(actions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment