Digistump Forums

The Digispark => Digispark Projects => Topic started by: RussNelson on August 17, 2012, 05:16:59 pm

Title: USB HID?
Post by: RussNelson on August 17, 2012, 05:16:59 pm
I get the impression that the Digispark allows a device to identify on USB as an HID device ... keyboard or mouse. If so, I have an awesome project: a presence detector. Hook up a PIR sensor (such as Sparkfun sells) to a single pin, and bump the mouse a tiny bit whenever it sees movement.
Title: USB HID?
Post by: a1k0n on August 17, 2012, 11:14:18 pm
You can use V-USB to do any kind of HID stuff you want on an AVR: http://www.obdev.at/products/vusb/index.html

Mice are easily possible.
Title: USB HID?
Post by: duckythescientist on December 26, 2012, 04:58:49 pm
The included DigiKeyboard library could work for that. I just finished writing the code to emulate a joystick (and posted on this forum), but I haven\'t looked into a mouse yet. I may do that next.
Title: USB HID?
Post by: digistump on December 26, 2012, 07:28:33 pm
There is some great code out there for vusb mouse emulation, we\'ll port it to a library when we have a chance, unless someone else gets there first.

Some good resources to work from:
http://www.ruinelli.ch/how-to-use-v-usb-on-an-attiny85
http://codeandlife.com/2012/02/04/avr-attiny-usb-tutorial-part-4/
Title: USB HID?
Post by: digistump on December 26, 2012, 07:29:23 pm
@Russ - for your specific application you could also just use the keyboard library and have it press something like shift or cntrl - so as to not disrupt anything.
Title: USB HID?
Post by: duckythescientist on December 26, 2012, 08:55:56 pm
I have mouse working. Tomorrow, I\'ll clean it up and post it.
Title: USB HID?
Post by: digistump on December 26, 2012, 09:33:31 pm
awesome - I\'ll check it out when you post it and then add joystick and mouse libraries at the same time