def happy_look_right(): with Sphero(mac_address=mac_address) as sphero: sleep(2) print("Look right") pixels = [ # Left Eye Pixel(x=1, y=2), Pixel(x=0, y=2), # Right Eye Pixel(x=6, y=2), Pixel(x=5, y=2) ] colors = [ # Left Eye Color(red=0xff, green=0xff, blue=0xff), Color(blue=0xff), # Right Eye Color(red=0xff, green=0xff, blue=0xff), Color(blue=0xff) ] for (pixel, color) in zip(pixels, colors): sphero.user_io.set_led_matrix_pixel(pixel, color)
def dizzy_look_left(): with Sphero(mac_address=mac_address) as sphero: sleep(2) print("Look left") pixels = [ # Left Eye Pixel(x=1, y=3), Pixel(x=2, y=3), # Right Eye Pixel(x=6, y=1), Pixel(x=7, y=1) ] colors = [ # Left Eye Color(red=0xff, green=0xff, blue=0xff), Color(blue=0xff), # Right Eye Color(red=0xff, green=0xff, blue=0xff), Color(blue=0xff) ] for (pixel, color) in zip(pixels, colors): sphero.user_io.set_led_matrix_pixel(pixel, color)
def normal_eyes(): with Sphero(mac_address=mac_address) as sphero: sleep(2) print("Show eyes in matrix") pixels = [ # Left Eye Pixel(x=0, y=1), Pixel(x=0, y=2), Pixel(x=0, y=3), Pixel(x=1, y=1), Pixel(x=1, y=2), Pixel(x=1, y=3), Pixel(x=2, y=1), Pixel(x=2, y=2), Pixel(x=2, y=3), # Right Eye Pixel(x=5, y=1), Pixel(x=5, y=2), Pixel(x=5, y=3), Pixel(x=6, y=1), Pixel(x=6, y=2), Pixel(x=6, y=3), Pixel(x=7, y=1), Pixel(x=7, y=2), Pixel(x=7, y=3) ] colors = [ # Left Eye Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), # Right Eye Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff), Color(red=0xff, green=0xff, blue=0xff) ] for (pixel, color) in zip(pixels, colors): sphero.user_io.set_led_matrix_pixel(pixel, color)