@ayaan_sharma (Ayaan  Sharma) posted a new topic, subject "HID keyboard key codes". It read:

   i am trying to use my Arduino Uno as a HID Keyboard. i saw a youtube video in which the guy uses arduino uno, flashes a keyboard firmware and when pressing a button, the arudino works as a keyboard. i also did the same thing with my arduino uno and everything WORKS FINE **BUT** the youtube guy provided an image which has keycodes for almost all keys. but i need keycodes for more keys. i cannot find them anywhere that match this guy's image and works for my arudio. i need key codes for volume+, volume-,mute. only three. here is that image :  
    
    
    Keyboard918×248 22.3 KB
    
      
    credit for image and code : Eward Hage
    [code] 
        uint8_t buf[8] = { 0 };   //Keyboard report buffer
        
        #define PIN_W 2 // Pin for w
        
        void setup() {
          Serial.begin(9600);
        
          pinMode(PIN_W, INPUT);
        
        }
        
        void loop() {
          if (digitalRead(PIN_W) == 1) {
            buf[2] = 26;
            Serial.write(buf, 8);
            releaseKey();
            delay(100);
          }
        
        
        }
        // Function for Key Release
        void releaseKey()
        {
          buf[0] = 0;
          buf[2] = 0;
          Serial.write(buf, 8); // Send Release key
        }
    [/code]

To which @b707 (B707) replied

    Are the keys volume+, volume- and mute - part of standard PC keyboard? If it are additional keys - it key codes can be varied from one keyboard manufacturer to another.  
    The solution may be to read the scancodes directly from your keyboard using a separate program, for example for Windows  
    https://www.nirsoft.net/utils/keyboard_state_view.html

@ayaan_sharma (Ayaan  Sharma) replied

    sir, in that software, it shows the following results(image):  
      
    but when i use these in my arduino, it doesnt control volume   
    btw, thanks for letting me know abt the software
    
    when i do the changes and set 175 for volume up, the arduino sends these codes to the PC as shown in image  
      
    the software cannot name this and the name of key is blank. i think, for arduino uno, the key codes are read differently by computers. sir please help me

Then @b707 (B707) said

    It seems to me that your keyboard has the specific driver that handles of non-standard scancodes... but this driver does not recognize the arduino as compatible device.

@ayaan_sharma (Ayaan  Sharma) replied

    so what should i do??  
    i am a newibe and a noob

To which @johnwasser (johnwasser) replied

    USB key codes for the keys you want:
    
    Dec | Hex |  |  | Key name  
    ---|---|---|---|---  
    127 | 0x7F |  |  | Keyboard Mute  
    128 | 0x80 |  |  | Keyboard Volume Up  
    129 | 0x81 |  |  | Keyboard Volume Down  
      
    The full list is in this document:
    
    usb.org
    
    ### hut1_12v2.pdf
    
    949.63 KB

Then @ayaan_sharma (Ayaan  Sharma) said

    Thank You so much sir !!!!


{'source': 'discourse', 'url': 'https://forum.arduino.cc/t/hid-keyboard-key-codes/1011438', 'title': 'HID keyboard key codes', 'views': 126, 'has_accepted_answer': True, 'word_count': 426, 'like_count': 1, 'reply_count': 4, 'participant_count': 3, 'posts': 7, 'tags': '', 'author': '@ayaan_sharma (Ayaan  Sharma)', 'participants': '@ayaan_sharma (Ayaan  Sharma), @b707 (B707), @johnwasser (johnwasser)', 'image_url': ['https://aws1.discourse-cdn.com/arduino/original/4X/1/1/4/114781aa9e26c56002ed8f611a9b3554dc2e0f52.png'], 'created_at': '2022-07-11T13:24:16.691Z', 'last_posted_at': '2022-10-07T17:09:21.464Z'}