In CPy HID examples, add a time.sleep() before creating the Keyboard().

Otherwise there's a race condition under some circumstances. See for example:
https://forums.adafruit.com/viewtopic.php?f=52&t=125560 and
https://forums.adafruit.com/viewtopic.php?f=52&t=130143&p=647131#p647135
This commit is contained in:
Dan Halbert 2018-01-27 23:15:24 -05:00
parent cdbab4f512
commit b76e23a798
2 changed files with 4 additions and 0 deletions

View file

@ -19,6 +19,8 @@ buttonkeys = [Keycode.A, "Hello World!\n"]
controlkey = Keycode.SHIFT
# the keyboard object!
# sleep for a bit to avoid a race condition on some systems
time.sleep(1)
kbd = Keyboard()
# we're americans :)
layout = KeyboardLayoutUS(kbd)

View file

@ -19,6 +19,8 @@ buttonkeys = [Keycode.A, Keycode.B, "Hello World!\n"]
controlkey = Keycode.SHIFT
# the keyboard object!
# sleep for a bit to avoid a race condition on some systems
time.sleep(1)
kbd = Keyboard()
# we're americans :)
layout = KeyboardLayoutUS(kbd)