Author Topic: digikeyboard.h will not send windows key inputs at all  (Read 2245 times)

jonjetjon

  • Newbie
  • *
  • Posts: 2
digikeyboard.h will not send windows key inputs at all
« on: August 08, 2019, 06:17:53 pm »
i purchased a digispark clone to use for it purposes but i am severely limited because it will not send the windows key at all, i have tried:
DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT | KEY_R);
DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
DigiKeyboard.sendKeyStroke(KEY_R, 0xE3);
none of these are working on my device when plugged into windows or debian linux computers.
« Last Edit: August 08, 2019, 06:35:39 pm by jonjetjon »

granzeier

  • Jr. Member
  • **
  • Posts: 73
Re: digikeyboard.h will not send windows key inputs at all
« Reply #1 on: August 09, 2019, 04:30:44 am »
I have noticed a lot of differences in the different keycode tables. It took checking several different tables before I found a good one for my project (sorry, I don't remember where I found the "right" one.) Also, if you are not using the U.S. keyboard layout, make sure that you find a table which matches your keyboard layout.
There was also a problem with using the keywords for the modifier, arrow and other keys, so I ended up using the decimal code numbers rather than names.
Finally, one guy was having troubles (https://digistump.com/board/index.php?topic=1907.0) and mentions (in the final post) adding a 10K ohm resistor - but he was talking about his pushbutton inputs. You have not said what is triggering your sending of the keycodes, but if you are using pushbuttons, then you want to either use 10K pullup resistors, or make sure that the internal pullups are enabled.

jonjetjon

  • Newbie
  • *
  • Posts: 2
Re: digikeyboard.h will not send windows key inputs at all
« Reply #2 on: August 10, 2019, 12:53:26 pm »
i did get it to work, but it seems to work only with the command
DigiKeyboard.sendKeyStroke(0,128);
for some reason.
also my scripts run automatically on plugin, and i figured out i was also losing the key inputs at the beginning which made the windows key problem more confusing, the only solution i could find for this was to send
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.delay(2000);
before sending the keyboard input or it seems the first few inputs get lost at random, slightly inconvenient but that seems to work. for future users of cheap clone boards: if none of your scripts seem to be working right but only at the beginning i would definitely start by adding a delay of 5000 or so, see if that fixes the problem, and if it does slowly tweak the delay down to find the minimum time you can delay before keyboard inputs work. it also could be caused by unreliable usb ports on my beat up windows 7 test machine i was using to test scripts.
« Last Edit: August 10, 2019, 12:55:14 pm by jonjetjon »