Skip to content

The eye change code for anki cozmo (you need the cozmo sdk)Β #227

@Readyornot69

Description

@Readyornot69

import cozmo
from cozmo.util import degrees

def set_eye_color(robot: cozmo.robot.Robot, color_name: str):
# Define RGB values for the colors
colors = {
"green": (0, 255, 0),
"red": (255, 0, 0),
"pink": (255, 105, 180)
}

# Set the eye color if it exists
if color_name in colors:
    r, g, b = colors[color_name]
    robot.set_center_led_color(cozmo.lights.Color(rgb=(r, g, b)))
    print(f"Eye color set to {color_name}.")
else:
    print("Invalid color name. Use 'green', 'red', or 'pink'.")

def cozmo_program(robot: cozmo.robot.Robot):
# Prompt user to choose a color
color = input("Enter a color (green, red, pink): ").lower()
set_eye_color(robot, color)

cozmo.run_program(cozmo_program)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions