HID scrollMouse

Posted on
  • Hello i'm trying to simulate a mouse with a HC-sr04.

    it works well with the x,y coord for the mouse from the example

    mouse.send(0,valueFromHcSR04,mouse.BUTTO­NS.NONE); // X movement, Y movement, buttons pressed
    

    in the report descriptor from here, there is line for x, y and mouseScroll 0x038
    description commented found on sparkfun's forum

      0x09,   0x30,
      0x09,   0x31,
      0x09,   0x38,
    

    How to send a mousescroll ? and which value should i send?

    best regards

    é.

  • it works like that

    E.sendUSBHID([0&7,0,0,sens]);
    

    where sens is equal 1 or -1 for scrollup or down

  • How to get mouse position (coords x,y) and not mouse mouvement?
    how to use a mouse mouvement in a webpage when mouse is down to the screen?

    regards

  • Thanks for posting up how to send the scrollup/down - that's great.

    You're asking how to send Absolute Position? Much like a tablet/touchscreen?

    I think what you need is USBTablet: http://www.espruino.com/USB#tablet

    However I don't think that supports a wheel by default! To get that you'll have to make your own HID report descriptor by mashing the wheel's descriptor into the tablet bit...

    https://github.com/espruino/EspruinoDocs­/blob/master/modules/USBMouse.js#L38
    https://github.com/espruino/EspruinoDocs­/blob/master/modules/USBTablet.js#L40

    But at that point my knowledge is at an end - you'll have to consult Google and use some trial and error to figure out what will work.

  • Thanxs @Gordon for the HIDtablet...
    but in my browser, i'm enable to fire an event
    no touchstart
    no mouse click
    no mousemove

    which event do i listen?

    regards
    é.

  • i tested chrome app with Serial connection...
    the example to connect an espruino in the google github doesn't work !
    ....
    The console.log output (or print()) is huggly to parse in a browser and lot of frame (1/3) are lost even in 9600baud...
    is there a better way to "print" to the serial port? (for sure there is but i'm a stupid graphic designer with too few knowledge in code) ;)

    thanks for your help

    regards

    ps: i'm looking for a "simple way" to introduce "tangible interface" (input from real world) for graphic design's students (with html5 and js bases NO Processing.org)... i'm testing chrome-app ... it's not the best way but the "easiest". (for my pov to combine : cheap hardware +html5/css/js (webtech) + newb.
    ok, i have to coming out: "i love espruino for learning only one langage to code Hardware and Web..."
    i have a lot of arduino compatible board but... i do not like the langage... therefore they take dust...

  • Honestly I'm not sure about the USBTablet stuff - it may be it wasn't recognised by your PC?

    Wow, first I've come across that 'connect to espruino' example. I can't get it to work either - but to be honest those hosted Chrome apps are being removed by Google soon anyway.

    How about trying this: https://github.com/espruino/EspruinoWebT­ools#uartjs

    It should be just what you want - it'll work off any HTTPS page as long as you view in an up to date Chrome web browser. Right now you have to enable it in chrome://flags (https://codelabs.developers.google.com/c­odelabs/web-serial/#2) but in a few months that won't be needed.

    You can use the Web Serial API directly, but the uart.js wrapper should provide a nice interface around it.

  • Gorgeous!
    I tested uart.js. Works fine and just as i need.
    Thanks very much @Gordon for your work.
    I took some time to request a serialapi token. It works in local (i was afraid to have to work online but i does not)
    I’m a happy guy. I have all i need.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

HID scrollMouse

Posted by Avatar for Mrbbp @Mrbbp

Actions