Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird double output with DigiKeyboard.h #29

Open
mateeees opened this issue Jan 22, 2022 · 1 comment
Open

Weird double output with DigiKeyboard.h #29

mateeees opened this issue Jan 22, 2022 · 1 comment

Comments

@mateeees
Copy link

Hi, I have a really weird problem, I don't know if it is my code or it is a bug. When I use DigiKeyboard.sendKeyStroke or DigiKeyboard.print it always prints the output a second time after a second or two. Also when I upload the code onto the digispark, disconnect it, and connect it again it just randomly prints the output.

An example: (I am trying to open Spotify using macropad)
DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT); DigiKeyboard.delay(1000); DigiKeyboard.print("spotify"); DigiKeyboard.delay(1000); DigiKeyboard.sendKeyStroke(KEY_ENTER);

It prints "spotify" twice, and also when I plug in the digispark. It is so random.
Thanks in advance.

@ghost
Copy link

ghost commented Aug 29, 2022

DigiKeyboard.sendKeyStroke() function is used for pressing keys on the keyboard.
DigiKeyboard.print() function is used to write what you want.

Check macropad key programming if it has some issues, because the sketch you provided is for windows keyboard.

To open Spotify, the sketch should like -

#include<DigiKeyboard.h>
void setup()
{
DigiKeyboard.delay(1000);
DigiKeyboard.sendKeyStroke(0,MOD_GUI_LEFT); //This keystroke is for press windows key only
DigiKeyboard.delay(1000);
DigiKeyboard.print("spotify");
DigiKeyboard.delay(1000);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
}
void loop()
{
//Nothing to run here
}

Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant