Created
May 3, 2023 19:47
-
-
Save leiserfg/94134b1a39cfa4112256b894d6e3e328 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import microcontroller | |
from kmk.keys import KC, make_key | |
from kmk.handlers.stock import passthrough | |
from kmk.handlers.sequences import send_string | |
def type_temp(*args, **kwargs): | |
temp = microcontroller.cpu.temperature | |
print(temp) #print to serial console | |
keyboard.process_key(send_string(repr(temp)), True) #type it on keyboard | |
keyboard.process_key(send_string(repr(temp)), False) | |
make_key(names=('TEMP',), on_press=type_temp, on_release=passthrough) | |
keyboard.keymap = [KC.TEMP] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment