Skip to content

Commit 9ebd2f4

Browse files
committed
Use native colorwheel.
1 parent f3e726f commit 9ebd2f4

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

Adafruit_MacroPad/MacroPad/code.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import rotaryio
55
import neopixel
66
import keypad
7+
from _pixelbuf import colorwheel
8+
79

810
key_pins = (board.KEY1, board.KEY2, board.KEY3, board.KEY4, board.KEY5, board.KEY6,
911
board.KEY7, board.KEY8, board.KEY9, board.KEY10, board.KEY11, board.KEY12)
@@ -15,19 +17,6 @@
1517

1618
pixels = neopixel.NeoPixel(board.NEOPIXEL, 12, brightness=0.2)
1719

18-
19-
def colorwheel(color):
20-
if color < 0 or color > 255:
21-
return 0, 0, 0
22-
if color < 85:
23-
return 255 - color * 3, color * 3, 0
24-
if color < 170:
25-
color -= 85
26-
return 0, 255 - color * 3, color * 3
27-
color -= 170
28-
return color * 3, 0, 255 - color * 3
29-
30-
3120
last_position = None
3221
while True:
3322
if not button.value:

0 commit comments

Comments
 (0)