Digistump Forums

The Digispark => Digispark (Original) Support => Topic started by: yocool13 on January 31, 2017, 01:29:44 pm

Title: "MOD_GUI_LEFT" Just prints an E
Post 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.
Code: [Select]
#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);
}
Title: Re: "MOD_GUI_LEFT" Just prints an E
Post by: exeng on January 31, 2017, 02:45:29 pm
Perhaps this will do what you want:
Code: [Select]
DigiKeyboard.sendKeyStroke('r',MOD_GUI_LEFT);
Title: Re: "MOD_GUI_LEFT" Just prints an E
Post by: yocool13 on February 02, 2017, 03:16:06 am
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.
Title: Re: "MOD_GUI_LEFT" Just prints an E
Post by: exeng on February 02, 2017, 10:10:02 am
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.
Title: Re: "MOD_GUI_LEFT" Just prints an E
Post by: MaMe82 on February 07, 2017, 05:31:42 am
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))

Title: Re: "MOD_GUI_LEFT" Just prints an E
Post by: MaMe82 on February 07, 2017, 05:44:05 am
In order to use MOD_UI left (without combining it with the "r" key, which is used for run on windows) use

Code: [Select]
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.