Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Readyornot69 opened this issue Dec 29, 2024 · 0 comments
Open

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

Readyornot69 opened this issue Dec 29, 2024 · 0 comments

Comments

@Readyornot69
Copy link

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)

@Readyornot69 Readyornot69 changed the title The eye change code for anki cozmo The eye change code for anki cozmo (you need the cozmo sdk) Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant