user7859: The hid_keyboard example sketch shows how to send ASCII characters, but how can I send non-ASCII codes like the F1 key, or keys with shift/control modifiers? 

user7859: Yo can use the keyboardReport() function to send key-codes with modifiers. Here is an example that will send an ! by sending the keycode for 1 plus a shift key modifier...
    // The keyboardReport() function takes an array of 6 keycodes. From what I can tell, it does not
    // press the keys consecutively,. it presses them simultainiously. 

    // Here we only want to send one code, so we back-fill the array with HID_KEY_NONE

    uint8_t keycodes[6] = { HID_KEY_1, HID_KEY_NONE , HID_KEY_NONE , HID_KEY_NONE , HID_KEY_NONE , HID_KEY_NONE };
    blehid.keyboardReport( KEYBOARD_MODIFIER_LEFTSHIFT , keycodes );  

    // This release seems to be required. Without it, the last pressed key just repeats forever. 
    blehid.keyRelease();   

The possible modifiers are listed here...
https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/200b3aaefb3256ac26df82ebc9b5b58923d9c37c/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h#L188
...and the possible keyscodes are listed here..
https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/200b3aaefb3256ac26df82ebc9b5b58923d9c37c/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h#L212
Unfortunately the hid_keycodes example does not compile, but bere is a ready-to-run example sketch showing how to send keycodes directly...
https://gist.github.com/bigjosh/5d8575f26988228dcf9d40c3795d0928

7859: <p>The <a href="https://github.com/adafruit/Adafruit_nRF52_Arduino/tree/master/libraries/Bluefruit52Lib/examples/Peripheral/hid_keyboard" rel="nofollow noreferrer"><code>hid_keyboard</code></a> example sketch shows how to send ASCII characters, but how can I send non-ASCII codes like the <code>F1</code> key, or keys with shift/control modifiers? </p>
 7859: <p>Yo can use the <code>keyboardReport()</code> function to send key-codes with modifiers. Here is an example that will send an <code>!</code> by sending the keycode for <code>1</code> plus a shift key modifier...</p>

<pre><code>    // The keyboardReport() function takes an array of 6 keycodes. From what I can tell, it does not
    // press the keys consecutively,. it presses them simultainiously. 

    // Here we only want to send one code, so we back-fill the array with HID_KEY_NONE

    uint8_t keycodes[6] = { HID_KEY_1, HID_KEY_NONE , HID_KEY_NONE , HID_KEY_NONE , HID_KEY_NONE , HID_KEY_NONE };
    blehid.keyboardReport( KEYBOARD_MODIFIER_LEFTSHIFT , keycodes );  

    // This release seems to be required. Without it, the last pressed key just repeats forever. 
    blehid.keyRelease();   
</code></pre>

<p>The possible modifiers are listed here...
<a href="https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/200b3aaefb3256ac26df82ebc9b5b58923d9c37c/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h#L188" rel="nofollow noreferrer">https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/200b3aaefb3256ac26df82ebc9b5b58923d9c37c/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h#L188</a></p>

<p>...and the possible keyscodes are listed here..
<a href="https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/200b3aaefb3256ac26df82ebc9b5b58923d9c37c/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h#L212" rel="nofollow noreferrer">https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/200b3aaefb3256ac26df82ebc9b5b58923d9c37c/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h#L212</a></p>

<p>Unfortunately the <code>hid_keycodes</code> example does not compile, but bere is a ready-to-run example sketch showing how to send keycodes directly...</p>

<p><a href="https://gist.github.com/bigjosh/5d8575f26988228dcf9d40c3795d0928" rel="nofollow noreferrer">https://gist.github.com/bigjosh/5d8575f26988228dcf9d40c3795d0928</a></p>
