KeyboardModifier for function key

Is there a way to have an arduino press the function key? I cannot find any.

Keyboard

You need a Leonardo, Micro, Esplora.

As noted in the post that follows, looks like there isn't a scan-code listed ( Keyboard Modifiers and Special Keys - Arduino Reference ).

I don't think the Fn-key actually sends any scan-code. It's interpreted locally and pressed in combination with another key, it does things like turning WIFI on and off. Also, I can't remember seeing Fn on an exterlal keyboard...

By "external", do you mean like a wireless keyboard?
They have Fn keys. Can't find a 'keyboard modifier' reference for it (just F-keys, not the same).

To use the F1 through F24 keys, just look them up in the USB HID Usage Tables:

Start on Page 53: Chapter 10: Keyboard/Keypad Page (0x07)

F1 through F12 = 58 through 69
F13 through F24 = 104 through 115

Then add the magic number 136 to them so they pass through Keyboard.press().

F1 through F12 = 194 through 205
F13 through F24 = 240 through 251

Note: Because Keyboard.press() and Keyboard.release() take arguments of type uint8_t (a.k.a. 'byte'), you can only use USB key codes up to 119 (255 after adding the magic 136). If you need keys with higher key codes (such as Volume Up and Volume Down) you can fix that problem by modifying the Keyboard library to add something like Keyboard.pressRaw() and Keyboard.releaseRaw() that uses the USB key code directly.

// pressRaw() adds the specified key (printing, non-printing, or modifier)
// to the persistent key report and sends the report.  Because of the way
// USB HID works, the host acts like the key remains pressed until we
// call release(), releaseAll(), or otherwise clear the report and resend.
size_t Keyboard_::pressRaw(uint8_t k)
{
  uint8_t i;

  // Add k to the key report only if it's not already present
  // and if there is an empty slot.
  if (_keyReport.keys[0] != k && _keyReport.keys[1] != k &&
      _keyReport.keys[2] != k && _keyReport.keys[3] != k &&
      _keyReport.keys[4] != k && _keyReport.keys[5] != k)
  {

    for (i = 0; i < 6; i++)
    {
      if (_keyReport.keys[i] == 0x00)
      {
        _keyReport.keys[i] = k;
        break;
      }
    }
    if (i == 6)
    {
      setWriteError();
      return 0;
    }
  }
  sendReport(&_keyReport);
  return 1;
}


// releaseRaw() takes the specified key out of the persistent key report and
// sends the report.  This tells the OS the key is no longer pressed and that
// it shouldn't be repeated any more.
size_t Keyboard_::releaseRaw(uint8_t k)
{
  uint8_t i;

  // Test the key report to see if k is present.  Clear it if it exists.
  // Check all positions in case the key is present more than once (which it shouldn't be)
  for (i = 0; i < 6; i++)
  {
    if (0 != k && _keyReport.keys[i] == k)
    {
      _keyReport.keys[i] = 0x00;
    }
  }

  sendReport(&_keyReport);
  return 1;
}

runaway_pancake:
They have Fn keys. Can't find a 'keyboard modifier' reference for it (just F-keys, not the same).

Look at these articles:

Finding the scan code of FN Key

https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html

Simplified, the "physical keyboard" sends scan codes to its driver where they are interpreted, and eventually modified, and passed on to the OS.

The keyboard library makes an Arduino appear as a HID (Human Interface Device) which sends HID scan codes to the OS, and, as I understand it, there is no code for the Fn-key.