Skip to content

Instantly share code, notes, and snippets.

@leiserfg
Created May 3, 2023 19:47
Show Gist options
  • Save leiserfg/94134b1a39cfa4112256b894d6e3e328 to your computer and use it in GitHub Desktop.
Save leiserfg/94134b1a39cfa4112256b894d6e3e328 to your computer and use it in GitHub Desktop.
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