Digistump Forums

The Digispark => Digispark (Original) Support => Topic started by: mcoscoy on January 18, 2017, 08:46:43 pm

Title: [HELP] Enter Key not working
Post 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
Code: [Select]
  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.

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.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);
}
Title: Re: [HELP] Enter Key not working
Post by: exeng on January 18, 2017, 09:20:14 pm
No sure what the intent of this line of code was...
Code: [Select]
  DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT);
But this modified example of your code works...
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.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);
}
Title: Re: [HELP] Enter Key not working
Post by: PeterF on January 18, 2017, 11:45:17 pm
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...  ???
Title: Re: [HELP] Enter Key not working
Post by: MaMe82 on February 07, 2017, 05:26:01 am
Try

Code: [Select]
DigiKeyboard.sendKeyStroke(KEY_ENTER, 0);