How to use Digistump DigiKeyboard library with ATTinyCore?

Continuing the discussion from Digistump Digispark no longer available?:

hello there, i tried the ATTinyCore... but its having error because my code uses a DigiKeyboard that was included in the digistump library... how can i make it work? thank you

hello @GolamMostafa, i need help... im running the ATTinyCore but the code im using is using digikeyboard... which is not included in ATTinyCore ... how can i use digikeyboard or other ways to emulate a keyboard stroke

please help ... thank you very much

its not working... what am i doing wrong

In my opinion the only real solution is to recover the old digispark-core and the digispark-driver archives. just done on my win10 pc with the zip files archived 4 years ago.

Hello, im having the same issue right now. Did you find a solution?

If you need keyboard emulation for a project, the best solution will be to get a different board that has native USB capabilities. The maintainer of ATTinyCore, DrAzzy/SpenceKonde intentionally did not add the "DigiKeyboard" library to ATTinyCore because they felt that it was not sufficiently functional:

https://github.com/SpenceKonde/ATTinyCore/blob/9e7024945b3a873fbb2f482d88625c4d2524ba92/avr/extras/Ref_Micronucleus.md#warning-this-doesnt-get-you-usb-from-within-your-sketch

Warning: This doesn't get you USB from within your sketch

In theory VUSB could be used to make a sketch act as a mouse, keyboard, MIDI device, or other USB device. In practice, this doesn't really work. The original digispark core bent over backwards to try to make it work, and it still didn't really work very well, Your best bet would be to disable millis, and make sure that nothing that disables interrupts can occur while you expect USB communication. There are also considerable obstacles to VUSB drivers on Windows platforms. I was only able to get two examples to compile. One example uploaded and gave "this device has malfunctioned", the other, which pretended to be a mouse, made the cursor go crazy for a few seconds before crashing. After discussions with individuals who know more about the USB protocol than I, I concluded that it would require throwing out too much of the Arduino API functionality to enable such a niche use. when there are always the u2 and u4 series

The Arduino Micro is a very nice board for keyboard emulation:

https://docs.arduino.cc/hardware/micro

Other boards that have the functionality:


If you are really set on trying to do keyboard emulation with the Digispark board, you can use this alternative boards platform:

I'll provide instructions you can follow to do that:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Enter the following URL into the "Additional Boards Manager URLs" field in the "Preferences" dialog:
    https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json
    
    :exclamation: If there are already Boards Manager URLs in the field, separate them with commas.
  3. Click the "OK" button.
    The "Preferences" dialog will close.
  4. You will now see a "Downloading index: ..." notification at the bottom right corner of the IDE window. Wait for that notification to close.
  5. Select Tools > Board > Boards Manager... from the Arduino IDE menus to open the "Boards Manager" view in the left side panel.
  6. Scroll down through the list of boards platforms until you see the "Digistump AVR Boards" entry.
  7. Click the "INSTALL" button at the bottom of the entry.
  8. Wait for the installation process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:

    Successfully installed platform ...

  9. Select Tools > Board > Digistump AVR Boards > Digispark (or "Digispark Pro (16 MHz)" if you have that board) from the Arduino IDE menus.

You will now be able to compile sketches that use the "DigiKeyboard" library. You can select File > Examples > DigiKeyboard > Keyboard from the Arduino IDE menus to open an example sketch that demonstrates the usage of the "DigiKeyboard" library.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.