You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def cozmo_program(robot: cozmo.robot.Robot):
# Find the first available cube
cube = robot.world.wait_for_observed_light_cube(timeout=30)
# If no cube is found, exit
if not cube:
robot.say_text("No cube found").wait_for_completed()
return
# Cycle through the rainbow colors for the cube's lights
for color in rainbow_colors:
# Set the cube light color
cube.set_light(color)
time.sleep(1) # Wait for 1 second before changing the color
# After cycling through, turn the lights off
cube.set_light(cozmo.lights.off)
robot.say_text("Rainbow pattern completed!").wait_for_completed()
cozmo.run_program(cozmo_program)
The text was updated successfully, but these errors were encountered:
import cozmo
from cozmo.util import degrees
import time
Rainbow colors (Red, Orange, Yellow, Green, Blue, Indigo, Violet)
rainbow_colors = [
cozmo.lights.Color(red=255, green=0, blue=0), # Red
cozmo.lights.Color(red=255, green=165, blue=0), # Orange
cozmo.lights.Color(red=255, green=255, blue=0), # Yellow
cozmo.lights.Color(red=0, green=255, blue=0), # Green
cozmo.lights.Color(red=0, green=0, blue=255), # Blue
cozmo.lights.Color(red=75, green=0, blue=130), # Indigo
cozmo.lights.Color(red=238, green=130, blue=238) # Violet
]
def cozmo_program(robot: cozmo.robot.Robot):
# Find the first available cube
cube = robot.world.wait_for_observed_light_cube(timeout=30)
cozmo.run_program(cozmo_program)
The text was updated successfully, but these errors were encountered: