File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: Copyright (c) 2021 Kattni Rembor for Adafruit Industries
2+ #
3+ # SPDX-License-Identifier: Unlicense
4+ """
5+ MacroPad rotation demo. Rotates the display 90 degrees and remaps the NeoPixels and keys to match.
6+ Lights up the associated pixel when the key is pressed. Displays the key number pressed and the
7+ rotary encoder relative position on the display.
8+ """
9+ from rainbowio import colorwheel
10+ from adafruit_macropad import MacroPad
11+
12+ macropad = MacroPad (rotation = 90 )
13+
14+ text_lines = macropad .display_text (title = "MacroPad \n Info" )
15+
16+ while True :
17+ key_event = macropad .keys .events .get ()
18+ if key_event :
19+ if key_event .pressed :
20+ text_lines [1 ].text = "Key {}!" .format (key_event .key_number )
21+ macropad .pixels [key_event .key_number ] = colorwheel (
22+ int (255 / 12 ) * key_event .key_number
23+ )
24+ else :
25+ macropad .pixels .fill ((0 , 0 , 0 ))
26+ text_lines [2 ].text = "Encoder {}" .format (macropad .encoder )
27+ text_lines .show ()
You can’t perform that action at this time.
0 commit comments