Tennsy Press dont work

Hi!

Im doing a program that will press CTRL+F7.
Im using a Teensy 3.1 to emulate that key combo.
I cant get the press to work.
I only get CTRL then F7 not CTRL+F7. So CTRL is not pressed.
Im been looking at ww.pjrc.com at there example and seems like im doing it right.

#include <usb_keyboard.h>

const int led = LED_BUILTIN;
void setup() {

}

void loop() {
  digitalWrite(led, HIGH);
  delay(100);
  digitalWrite(led, LOW);
  delay(100);
  
  

// press and hold CTRL
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.send_now();
// press DELETE, while CLTR and ALT still held
Keyboard.set_key1(KEY_F7);
Keyboard.send_now();
// release all the keys at the same instant
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();

  delay(2000);
}
// press and hold CTRL
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.send_now();

The send_now() method looks to me like it makes a lie of your comment.

// press DELETE, while CLTR and ALT still held
Keyboard.set_key1(KEY_F7);
Keyboard.send_now();

That code does NOT match that comment!

Try:

Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.set_key1(KEY_F7);
Keyboard.send_now();

sorry, about the comment. It from the original example code.

i have tried

// press and hold CTRL
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.set_key1(KEY_F7);
Keyboard.send_now();
// release all the keys at the same instant
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();

Same result. The CTRL is still not pressed.

I did find a solution. Not sure if it totally correct but it works.
Its seems you need to release the none hold key before you do realeaseall().

here are the code thats works:

Keyboard.press(KEY_F7);
Keyboard.press(MODIFIERKEY_CTRL);
Keyboard.release(KEY_F7);
delay(100);
Keyboard.releaseAll();


  delay(2000);