Author Topic: [HELP] Enter Key not working  (Read 4689 times)

mcoscoy

  • Newbie
  • *
  • Posts: 1
[HELP] Enter Key not working
« 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);
}

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: [HELP] Enter Key not working
« Reply #1 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);
}

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: [HELP] Enter Key not working
« Reply #2 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...  ???

MaMe82

  • Newbie
  • *
  • Posts: 9
Re: [HELP] Enter Key not working
« Reply #3 on: February 07, 2017, 05:26:01 am »
Try

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