Author Topic: USB HID?  (Read 8140 times)

RussNelson

  • Newbie
  • *
  • Posts: 23
USB HID?
« 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.
« Last Edit: August 17, 2012, 05:16:59 pm by RussNelson »

a1k0n

  • Newbie
  • *
  • Posts: 2
USB HID?
« Reply #1 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.

duckythescientist

  • Newbie
  • *
  • Posts: 27
USB HID?
« Reply #2 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.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
USB HID?
« Reply #3 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/

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
USB HID?
« Reply #4 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.

duckythescientist

  • Newbie
  • *
  • Posts: 27
USB HID?
« Reply #5 on: December 26, 2012, 08:55:56 pm »
I have mouse working. Tomorrow, I\'ll clean it up and post it.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
USB HID?
« Reply #6 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