Write data to USB HID using JavaScript, HTML5, or any cross platform language (supports Android)

前端 未结 5 485
太阳男子
太阳男子 2021-02-04 08:24

I\'ve written an UI in HTML5 and JavaScript. I chose this implementation so that I could share the same code between both Android Chrome and Windows 8 RT.

Now, my next ob

5条回答
  •  再見小時候
    2021-02-04 08:50

    Writing to a serial port:

    var writeSerial = function(str) {
      chrome.serial.write(connectionId, str2ab(str), onWrite);
    }
    
    // Convert string to ArrayBuffer
    var str2ab = function(str) {
      var buf = new ArrayBuffer(str.length);
      var bufView = new Uint8Array(buf);
      for (var i=0; i

    More is at http://developer.chrome.com/apps/app_hardware.html.

提交回复
热议问题