def call_d(): """ Callback for Button 'Name D' event. """ global eye print('Bottom right') eye = Eye(4, Eye.GRB) eye.set_color(255, 0, 0)
def call_b(): """ Callback for Button 'Name B' event. """ global eye print('Top right') eye = Eye(2, Eye.GRB) eye.set_color(255, 0, 0)
def call_c(): """ Callback for Button 'Name C' event. """ global eye print('Bottom left') eye = Eye(3, Eye.GRB) eye.set_color(255, 0, 0)
def call_a(): """ Callback for Button 'Name A' event. """ global eye print('Top left') eye = Eye(1, Eye.GRB) eye.set_color(255, 0, 0)
def test_eyes(): global eyes, servo, motor, j, eye, i eyes = [Eye(1, Eye.RGB), Eye(2, Eye.RGB), Eye(3, Eye.RGB), Eye(4, Eye.RGB)] servo = Servo(2) motor = Motor(2) for j in range(1, 5): eye = eyes[int(j - 1)] for i in range(0, 256, 25): time.sleep(0.2) eye.set_color(i, i, i) servo.set_angle(90) time.sleep(0.2)
def set_led(red, green, blue): """ Use the hucon eye driver to set the eye color. """ try: from hucon import Eye Eye(1, Eye.RGB).set_color(red, green, blue) Eye(2, Eye.RGB).set_color(red, green, blue) Eye(3, Eye.RGB).set_color(red, green, blue) Eye(4, Eye.RGB).set_color(red, green, blue) except Exception as ex: print(ex)
""" 2018-12-11 Set eye color of first. Author: [email protected] """ from hucon import Eye eye = None print('Set the color for the top left eye.') eye = Eye(1, Eye.RGB) eye.set_color(255, 0, 0)
""" Set eye color of all. Copyright (C) 2019 Basler AG All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ from hucon import Eye eye_tl = None eye_tr = None eye_bl = None eye_br = None eye_tl = Eye(1, Eye.RGB) eye_tr = Eye(2, Eye.RGB) eye_bl = Eye(3, Eye.RGB) eye_br = Eye(4, Eye.RGB) eye_tl.set_color(255, 0, 0) eye_tr.set_color(0, 255, 0) eye_bl.set_color(0, 0, 255) eye_br.set_color(255, 255, 255)