File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
EyeLights_Accelerometer_Tap/EyeLights_Accelerometer_Tap_CircuitPython Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 5454interpolated_color = (0 , 0 , 0 ) # LEDs off at startup, they'll ramp up
5555
5656
57- def fill_color (color ):
58- """Given an (R,G,B) tuple, fill both LED rings with this color."""
59- # Convert tuple to a 'packed' 24-bit value
60- packed = (int (color [0 ]) << 16 ) | (int (color [1 ]) << 8 ) | int (color [2 ])
61- for i in range (24 ):
62- glasses .left_ring [i ] = glasses .right_ring [i ] = packed
63-
64-
6557while True : # Loop forever...
6658
6759 # The try/except here is because VERY INFREQUENTLY the I2C bus will
@@ -79,7 +71,14 @@ def fill_color(color):
7971 interpolated_color [2 ] * 0.85 + target_color [2 ] * 0.15 ,
8072 )
8173 # Fill both rings with interpolated_color, then refresh the LEDs.
82- fill_color (interpolated_color )
74+ # fill_color(interpolated_color)
75+ packed = (
76+ (int (interpolated_color [0 ]) << 16 )
77+ | (int (interpolated_color [1 ]) << 8 )
78+ | int (interpolated_color [2 ])
79+ )
80+ glasses .left_ring .fill (packed )
81+ glasses .right_ring .fill (packed )
8382 glasses .show ()
8483
8584 # The look-down detection only needs the accelerometer's Y axis.
You can’t perform that action at this time.
0 commit comments