Skip to content

Instantly share code, notes, and snippets.

@iwootten
Created May 25, 2021 14:45
Show Gist options
  • Select an option

  • Save iwootten/de5d2ead775430fa4bbe55a46a42a06e to your computer and use it in GitHub Desktop.

Select an option

Save iwootten/de5d2ead775430fa4bbe55a46a42a06e to your computer and use it in GitHub Desktop.
import time
import picokeypad as keypad
keypad.init()
keypad.set_brightness(1.0)
lit = 0
last_button_states = 0
colour_index = 0
NUM_PADS = keypad.get_num_pads()
while True:
for colour_index in range(0, 5):
for i in range(0, NUM_PADS):
if colour_index == 0:
keypad.illuminate(i, 0x00, 0x20, 0x00)
elif colour_index == 1:
keypad.illuminate(i, 0x20, 0x20, 0x00)
elif colour_index == 2:
keypad.illuminate(i, 0x20, 0x00, 0x00)
elif colour_index == 3:
keypad.illuminate(i, 0x20, 0x00, 0x20)
elif colour_index == 4:
keypad.illuminate(i, 0x00, 0x00, 0x20)
elif colour_index == 5:
keypad.illuminate(i, 0x00, 0x20, 0x20)
keypad.update()
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment