arduino leonardo as keyboard input

 I need a fast key for space bar and arrows to control netflix. 

arduino has a keyboard.h lib for HID capable, seach on web, it seems keyboard sends out value for each key. presented as key codes

I need:

VK_SPACE0x20空格鍵
VK_LEFT0x25向左鍵
VK_RIGHT0x27向右鍵


I tried example from keyboard.write() it write "A" when D2 pressed.
it works, but print out several "A"s, when pressed once, I think I need to use edge detection. 




鍵 盤 鍵 碼 值 對 照 表
 數字鍵鍵碼值 數字鍵鍵碼值 數字鍵鍵碼值
149F1112Numbpad 096
250F2113Numbpad197
351F3114Numbpad298
452F4115Numbpad399
553F5116Numbpad4100
654F6117Numbpad5101
755F7118Numbpad6102
856F8119Numbpad7103
957F9120Numbpad8104
  F10121Numbpad9105
  F11122Multiply (*)106
  F12123Add (+)107
    Enter108
    Subtract (-)109
    Decimal (.)110
    Divide (/)111
字母鍵碼值字母鍵碼值其它鍵鍵碼值其它鍵鍵碼值
A65N78Backspace8Left Arrow37
B66O79Tab9Up Arrow38
C67P80Clear12Right Arrow39
D68Q81Enter13Down Arrow40
E69R82Shift16Insert45
F70S83Control17Delete46
G71T84Alt18Help47
H72U85Caps Lock20Num Lock144
I73V86Esc27; :186
J74W87Spacebar32= +187
K75X88Page Up33- _189
L76Y89Page Down34/ ?191
M77Z90End35\Q ~192
    Home36[ {219
      \ |220
      ] }221
      '' '222

I get my arduino leobardo work with space bar(0x20) and K(0X4B) to stop youtube.
but left arrow(0x25) does not work, in return , J(0X4A) as back 10sec and L(0X4C)
works.

留言

這個網誌中的熱門文章

AIS0. understanding AIS NMEA 0183: How it's coded

ELRS on Pixhawk 2.4 with ardupilot

Meshtastic 03 adding GPS on TTGO lora32 V2