Author Topic: HID keyboard button press and release  (Read 3144 times)

adammhaile

  • Newbie
  • *
  • Posts: 2
HID keyboard button press and release
« on: April 08, 2013, 01:00:44 pm »

I'm trying to use the DigiKeyboard library to mimic a HID keyboard and I found how to send keys and how to release ALL of them, by calling usbSetInterrupt() with 0 for the key value, but is there a way to release one key and not another. I'm using this for a game controller so, for example, I'm holding down the button that corresponds to Left-Arrow and press and release the A button. I want it to register as:


 - Left Arrow Press
 - A Press
 - A Release
 - Left Arrow Release


But all I can do now is basically momentary presses on each. Each time I press a button down it registers as press AND release on the computer. Is there a way to call usbSetInterrupt() or something else telling it that only one of the previously pressed keys has now been released?

duckythescientist

  • Newbie
  • *
  • Posts: 27
Re: HID keyboard button press and release
« Reply #1 on: April 17, 2013, 03:47:16 pm »
I'm downloading the new library version to see what to do about it, but in the mean time, if this is for a game controller, why not use the joystick library?

lucenacsl

  • Newbie
  • *
  • Posts: 2
Re: HID keyboard button press and release
« Reply #2 on: May 07, 2017, 07:02:56 pm »
Hello, this subject is also of interest to me. I have a project with I intend to create a game control with buttons only, but I can not. But I can not make a scketch that the computer recognizes as a game controller a Digispark. My progress was only using an Arduino Leonardo, I made the PC recognize as a keyboard, determining some buttons for the buttons. But I need help. I'm not getting libraries to make a Digispark work like a keyboard.