Hi
I am wondering if there is keyboard/mouse HID functionality support for DigiSpark/ATtiny85. I have some small projects I was playing 2-3 years ago and they no longer work, I was unable to compile the code as there are no DigiKeyboard.h and HID.h libraries, digistump no longer exist. I was unable to solve this in the last 2 days, so I came here to ask the community if there are alternatives to this.
Thanks
Hi @b-rduino. Are you using the ATTinyCore boards platform to add support for the Digispark to Arduino IDE?
The maintainer of ATTinyCore, DrAzzy/SpenceKonde intentionally did not add the "DigiKeyboard" library to ATTinyCore because they felt that it was not sufficiently functional:
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
If you need keyboard emulation for a project, the best solution will be to get a different board that has native USB capabilities. 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:
- Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open. - 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
If there are already Boards Manager URLs in the field, separate them with commas. - Click the "OK" button.
The "Preferences" dialog will close. - You will now see a "Downloading index: ..." notification at the bottom right corner of the IDE window. Wait for that notification to close.
- Select Tools > Board > Boards Manager... from the Arduino IDE menus to open the "Boards Manager" view in the left side panel.
- Scroll down through the list of boards platforms until you see the "Digistump AVR Boards" entry.
- Click the "INSTALL" button at the bottom of the entry.
- 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 ...
- 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.
Wow, thanks for that alternative: Additional Boards Manager URLs, I did use drazzy instead and installed ATTinyCore, I also found that first post...
After setting that additional boards manager URL - i was able to find and install Digistump AVR Boards, now the things look more familiar as in the past. I'll be playing around this.
Thank you ![]()
You are welcome. I'm glad if I was able to be of assistance.
Regards, Per
It works!
Thanks you, I revived the old scripts for DigiSpark.
This post can be as reference for who has the same problem. ![]()
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.