I have a very simple code example (see below) running on the Neo Trinkey that types the word "Password" when the Capacitive Touch button 2 is pressed. From what I understand, this emulates a USB keyboard and is working fine on my windows 10 computer. The problem is I want this to wake the computer from sleep like a normal usb keyboard. This does not currently work. Is there anyway to get this working? I once saw a tutorial (cant find this now) of someone using an Arduino ATtiny85 to wake a computer from sleep utilizing keyboard emulation, so I know it is possible in theory. I think they ended up editing the usb.config.h file by changing the Vendor ID and Product to ID vid=046d, pid=c52b. I believe vid=046d, pid=c52b is the standard HP keyboard, which loads standard Microsoft keyboard drivers and everything then works. I have looked in the adafruit_hid library folder, which contains the below files, but I can't see how to change this ID there?
mouse.mpy
keycode.mpy
keyboard_layout_us.mpy
keyboard_layout_base.mpy
keyboard.mpy
consumer_control_code.mpy
consumer_control.mpy
__init__.mpy
Is there anyway to wake the computer with the Neo Trinkey?
Code: Select all
"""CircuitPython Capacitive Touch HID Example for Neo Trinkey"""
import time
import board
import touchio
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayoutUS(keyboard)
touch2 = touchio.TouchIn(board.TOUCH2)
while True:
if touch2.value: # If touch pad 2 is touched...
while touch2.value: # Wait for release...
time.sleep(0.1)
keyboard_layout.write("PASSWORD\n") # Then send string.