File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22#
33# SPDX-License-Identifier: Unlicense
44import time
5+
56import usb_hid
67from adafruit_hid .keyboard import Keyboard
78from adafruit_hid .keyboard_layout_us import KeyboardLayoutUS
89import adafruit_ducky
910
11+ import touchio # pylint: disable=unused-import
12+ import board
13+ import neopixel
14+ from digitalio import DigitalInOut , Pull # pylint: disable=unused-import
15+
16+ # Uncomment for Neo Trinkey
17+ touch1 = touchio .TouchIn (board .TOUCH1 )
18+ touch2 = touchio .TouchIn (board .TOUCH2 )
19+
20+ # Uncomment for NeoKey Trinkey
21+ #button = DigitalInOut(board.SWITCH)
22+ #button.switch_to_input(pull=Pull.DOWN)
23+ #button_state = False
24+
25+ pixels = neopixel .NeoPixel (board .NEOPIXEL , 4 )
26+
27+ pixels .fill ((0xFFFFFF ))
28+
1029time .sleep (1 ) # Sleep for a bit to avoid a race condition on some systems
1130keyboard = Keyboard (usb_hid .devices )
1231keyboard_layout = KeyboardLayoutUS (keyboard ) # We're in the US :)
1332
1433duck = adafruit_ducky .Ducky ("duckyscript.txt" , keyboard , keyboard_layout )
1534
1635result = True
36+ running = False
1737while result is not False :
18- result = duck .loop ()
38+ #if button.value: # Uncomment for NeoKey Trinkey
39+ if any ([touch1 .value , touch2 .value ]): # Uncomment for Neo Trinkey
40+ running = not running
41+ if running :
42+ pixels .fill ((0x00FF00 ))
43+ else :
44+ pixels .fill ((0xFF0000 ))
45+ time .sleep (0.2 )
46+ if running :
47+ result = duck .loop ()
You can’t perform that action at this time.
0 commit comments