arduino-libraries / Keyboard

GNU Lesser General Public License v3.0
231 stars 160 forks source link

when I use Keyboard.h, could I press keycode instead of keyASCII? #26

Open ljq29 opened 4 years ago

ljq29 commented 4 years ago

It is generally accepted that when the header file Keyboard.h is used, some control keys can be sent through the Keyboard.press (key) function. But for keys without ASCII values, such as KEYCODE_VOLUME_UP and KEYCODE_VOLUME_DOWN, how should they be sent to the host through arduino?

anaicagrouver commented 4 years ago

0x80 Keyboard Volume Up 0x81 Keyboard Volume Down 0x7F Keyboard Mute You can also see the list here

thekunalsaini commented 4 years ago

@ljq29 you can use hex codes for this

ljq29 commented 4 years ago

@ljq29 you can use hex codes for this

So, from where I can find the table of keycode 2 hex?

thekunalsaini commented 4 years ago

@ljq29 Google it man it is easily available

thekunalsaini commented 4 years ago

If @ljq29 you are satisfied give a good feedback ;)

edgar-bonet commented 3 years ago

KEYCODE_VOLUME_UP and KEYCODE_VOLUME_DOWN

On the keyboards I tried, these keys use a different endpoint and a different protocol than all the “regular” keys. They can thus not be sent by the Keyboard library. Not without heavy modifications.

ljq29 commented 3 years ago

KEYCODE_VOLUME_UP and KEYCODE_VOLUME_DOWN

On the keyboards I tried, these keys use a different endpoint and a different protocol than all the “regular” keys. They can thus not be sent by the Keyboard library. Not without heavy modifications.

What about functional keyboard? Some keyboard do have VOLUME_UP and VOLUME_DOWN key, such as logitech K380.

edgar-bonet commented 3 years ago

@ljq29: Yes, that is what I am talking about. I have a couple of keyboards that, in addition to all the regular keys, have these VOLUME_UP and VOLUME_DOWN keys. My tests show that those keys are sent through a different USB endpoint.

ljq29 commented 3 years ago

@ljq29: Yes, that is what I am talking about. I have a couple of keyboards that, in addition to all the regular keys, have these VOLUME_UP and VOLUME_DOWN keys. My tests show that those keys are sent through a different USB endpoint.

So, is this libraries will not support VOLUME_DOWN and VOLUME_UP keys?

edgar-bonet commented 3 years ago

@ljq29: Indeed. This library does not support the VOLUME_DOWN and VOLUME_UP keys.