Digistump Forums
The Digispark => Digispark (Original) Support => Topic started by: yocool13 on January 31, 2017, 01:29:44 pm
-
I tried making a simple test script that would open Rick Astleys "Never gonna give you up" but when I test it after uploading it, it doesnt press the Windows key, instead it just prints an E.
#include "DigiKeyboard.h"
void setup() {
// don't need to set anything up to use DigiKeyboard
}
void loop() {
// this is generally not necessary but with some older systems it seems to
// prevent missing the first character after a delay:
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.delay(500);
DigiKeyboard.sendKeyStroke(MOD_GUI_LEFT);
DigiKeyboard.delay(750);
DigiKeyboard.print("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
DigiKeyboard.delay(800);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(5000);
}
-
Perhaps this will do what you want:
DigiKeyboard.sendKeyStroke('r',MOD_GUI_LEFT);
-
That seems to have done the trick. I also have a different problem where “ DigiKeyboard.sendKeyStroke(KEY_DELETE, MOD_ALT_RIGHT | MOD_CONTROL_LEFT);“ doesnt do anything at all.
-
I don't see KEY_DELETE defined in DigiKeyboard.h. You could try adding #define KEY_DELETE 0x63 (or 99) which I believe is (haven't tested it) the code for the numeric pad del key.
-
For EN_US keyboard layout, the USB code for delete key is 0x4C (see http://www.freebsddiary.org/APC/usb_hid_usages.php (http://www.freebsddiary.org/APC/usb_hid_usages.php))
-
In order to use MOD_UI left (without combining it with the "r" key, which is used for run on windows) use
DigiKeyboard.sendKeystroke(0xe3, 0x08)
Which uses 0xe3 as key (GUI_LEFT) and 0x08 as modifier (GUI_LEFT_MODIFIER).
This is usesful on systems, where the GUI key is used without combining it with additional keys.