Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: More Joystick questions

  1. #1

    More Joystick questions

    I need 8 analog joystick channels + 2 digital. My application is not a standard game controller, it is an R/C model controller so I don't have "sliders" and "hats" or "wheels". I have pitch, roll, yaw, throttle, mode, camera pitch, camera yaw, mode2, spare, etc.

    I found some code examples, and have 3, sometimes 5, sometimes 6 channels working.

    I have three major issues: First, I don't know what the library expects for names. Right now, I'm using -

    Joystick.X(analogRead(0));
    Joystick.Y(analogRead(1));
    Joystick.Zrotate(analogRead(2));
    Joystick.Z(analogRead(3));
    Joystick.sliderRight(analogRead(4));
    Joystick.sliderLeft(analogRead(5));

    If I need more channels of analog, what names does the library expect? It would be so much easier (and more universal) if they were simply called Joystick.0, Joystick.1 etc.

    Second, I need to be able to TRIM the joysticks with up/down buttons. I can write something that adds an offset to the analog readings to give me that trim, but is there something already in the library (that might be undocumented) that can do that automatically for me? I realize that I would have to save the offsets in EEPROM.

    Third, my application unfortunately must use the Windows (10) joystick driver, which remaps things and changes ranges. I have tried to contact MS about this to see if there is a registry entry or .inf file that I can use to "lock down" the various inputs and ranges, but so far, I haven't been successful. Does someone have more insight into how Windows treats joysticks and how I can easily map the sticks and ranges when I use the same joystick controller across different machines - hopefully without the "calibration" exercise?

    More generally, does the TEENSY simply send a string of 10-bit values (+511/-511) in succession with a gap for sync to the PC, or is it more complicated than that? Some discussions talk about 10 or even 12 bit joystick values, but when I go to the CALIBRATE function in Windows, and choose "display raw values", it displays only signed byte values (+127/-127), so is there some "disconnect"? And in what format is the data sent - binary, ASCII? MSB or LSB first? And does the program send the data in the order dictated by their order in the program, or is there a predefined fixed string sent and any data collected is simply put into the correct byte "cell" and sent?

    Any help or insight would be greatly appreciated!

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,053
    You might take a look at the thread: https://forum.pjrc.com/threads/23681...ll=1#post41942

  3. #3
    Quote Originally Posted by KurtE View Post
    You might take a look at the thread: https://forum.pjrc.com/threads/23681...ll=1#post41942
    Thanks! That gives me something to study. I know nothing about "joystick descriptors", that might be the answer to most of my Windows issues.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •