1

I know that there is a javascript (maybe library?) that can handle this, but what is the syntax and how do I do this? Also, how do I code the usb to send the signal to the JS or HTML?

(sorry, but I am a noob at all things hardware, and I need this to work XD)

Mikey
  • 184
  • 1
  • 3
  • 18

1 Answers1

0

you can use node-usb for this https://github.com/tessel/node-usb, compare the docs to the USB basics in http://www.beyondlogic.org/usbnutshell/usb1.shtml

in general for accessing a USB device the following steps have to be done :

  • device

  • configuration ( in node-usb only the default configuration is supported )

  • claim interface

  • access endpoints ( writing and reading the actual data )

cf http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/ and other libusb tutorials

a general example for node-usb is in How to send data to USB device in node.js using libusb

http://mikeheavers.com/tutorials/reading_data_from_usb_devices_using_javascript/

a more advanced example ( kinect control ) is in https://github.com/schakko/node-usb/blob/master/examples/kinect/kinect.js

( https://developers.google.com/web/updates/2016/03/access-usb-devices-on-the-web )

ralf htp
  • 9,149
  • 4
  • 22
  • 34