Digistump Forums
The Digispark => Digispark (Original) Support => Topic started by: mcoscoy on January 18, 2017, 08:46:43 pm
-
My Digispark arrived today, but for some reason, I cannot get it to register the enter key! I also tried to use
DigiKeyboard.sendKeyStroke(40); for the enter key, but that doesn't work either. I'm at a loss.
This is what I'm trying to code, but the Digispark doesn't click enter in the windows menu.
#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.delay(100);
DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT);
DigiKeyboard.delay(100);
DigiKeyboard.println("http://www.techspot.com/downloads/downloadnow/5711/?evp=2f65f723ab3c3592558f7859ee425900&file=1");
DigiKeyboard.delay(100);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
}
-
No sure what the intent of this line of code was...
DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT);
But this modified example of your code works...
#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.delay(100);
//DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT);
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.delay(100);
DigiKeyboard.println("Hello Digispark");
DigiKeyboard.delay(100);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
}
-
I think the MOD_GUI_LEFT was supposed to press the left windows key on the keyboard... but feel free to say I'm dreamin'!
Still doesn't explain why KEY_ENTER didn't work... ???
-
Try
DigiKeyboard.sendKeyStroke(KEY_ENTER, 0);