Describe the bug
Trying out an example to send particular keycodes based on conditions in loop. Key is being sent once but in the loop, the keys are not being sent.
To Reproduce
Board used is ESP32-S3-N16R8.
Circuit Python version 9.0.3
import board
import time
from kmk.kmk_keyboard import KMKKeyboard
from kmk.keys import KC
keyboard = KMKKeyboard()
keyboard.debug_enabled = True
# Keycodes
B = KC.B
# C = KC.C
counter = 0
# Main loop function to send keycodes and wait
def main_loop():
global counter
while True:
# Increment the counter each cycle
counter += 1
print(f"Sending 'B', Count: {counter}")
# keyboard.tap_key(B)
keyboard.keys_pressed.add(KC.B)
keyboard.process_key(KC.B, True)
time.sleep(0.1)
keyboard.keys_pressed.discard(KC.B)
keyboard.process_key(KC.B, False)
# keyboard.tap_key(C)
# Wait for 10 seconds
time.sleep(10)
if __name__ == '__main__':
main_loop()
Describe the bug Trying out an example to send particular keycodes based on conditions in loop. Key is being sent once but in the loop, the keys are not being sent.
To Reproduce Board used is ESP32-S3-N16R8. Circuit Python version 9.0.3
with the output
The following getting started code does work
with the output
Expected behavior A clear and concise description of what you expected to happen. Key B is sent every 10 seconds