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

Thread: Joystick calibration in windows 7 issues

  1. #1
    Junior Member
    Join Date
    Nov 2014
    Posts
    7

    Joystick calibration in windows 7 issues

    Hey guys just got my teensy 3.1 yesterday and have been doing some of the tutorials since im new to microcontrollers and coding in general.

    I was having great success and working towards the code for my own custom joystick.
    I was testing a variation of the example joystick codes (minimalized for my breadboard tests, code is at the bottom). The device was up and running great and recognized as a controller in a few of my games but I wanted to try and calibrate my main x and y axis'.

    When I go to the properties of the game controller (in Devices and printers) the test screen is blank and under the settings tab the calibrate button is greyed out (this is on y main windows 7 pc).

    Click image for larger version. 

Name:	windows 7.JPG 
Views:	409 
Size:	50.4 KB 
ID:	2976

    Using pointy's joystick test program i can also see the controller and watch the buttons and axis change. Windows 7 is definitely seeing it and like I say it is working my games, I just cant calibrate it
    Click image for larger version. 

Name:	windows 7-1.JPG 
Views:	1370 
Size:	47.4 KB 
ID:	2977

    I then tried on my windows 8 laptop and it worked perfectly. I could see the live test view and also calibrate
    Click image for larger version. 

Name:	windows8-1.PNG 
Views:	272 
Size:	57.5 KB 
ID:	2978

    Click image for larger version. 

Name:	windows8-2.PNG 
Views:	696 
Size:	13.6 KB 
ID:	2979

    Ive tried uninstalling all my usb drivers on my windows 7 pc, different usb port and other usb joystick example codes and nothing has worked. Ive also tried the ctrl-shift click on the properties button and that didnt work either.

    Any help would be greatly appreciated.

    Code:
    /* Basic USB joystick Code (modified)
    
       Pushbuttons should be connected to digital pins 12, 11, 10.
       Wire each button between the digital pin and ground.
       
       Potentiometers should be connected to analog inputs A0 & A1 (ie pins 14 & 15).
       Pots should be wired to AGND and 3.3V (not Vin) with center wire to Analog pin.
    */
    
    #include <Bounce.h>
    
    Bounce button0 = Bounce(12, 10); // 10 = 10 ms debounce time
    Bounce button1 = Bounce(11, 10);  
    Bounce button2 = Bounce(10, 10);
    
    void setup() {
      //set read resolution to 12 bit for greater accuracy
      analogReadResolution(12);
      
      // Set pins to input - use A# system of designating analog pins so its not confusing
      pinMode(A0, INPUT_PULLUP); 
      pinMode(A1, INPUT_PULLUP); 
      pinMode(12, INPUT_PULLUP);
      pinMode(11, INPUT_PULLUP);
      pinMode(10, INPUT_PULLUP); 
    }
    
    void loop() {
      // read analog inputs and set X-Y position
      Joystick.X(analogRead(A0));
      Joystick.Y(analogRead(A1));
    
      // read the digital inputs and set the buttons
      button0.update();
      button1.update();
      button2.update();
    
    //button0 is connected to a maintained on/off switch. Didnt want signal from it to be continuos hence delay signal stopped.
    // need to figure out a way so that the delay doesnt cause a stutter in other readings like the x & y axis
    if (button0.fallingEdge()) {
        Joystick.button(1, 1);
        delay(200);
        Joystick.button(1, 0);
      }
    if (button1.fallingEdge()) {
        Joystick.button(2, 1);
      }
    if (button2.fallingEdge()) {
        Joystick.button(3, 1);
      }
      
    // when button0 is turned to the off postion this sends a different button command then when flicked to on position. this allows 2 commands from the one switch  
    if (button0.risingEdge()) {
        Joystick.button(4, 1);
        delay(200);
        Joystick.button(4, 0);
      }
    if (button1.risingEdge()) {
        Joystick.button(2, 0);
      }
    if (button2.risingEdge()) {
        Joystick.button(3, 0);
      }
      
      // a brief delay, so this runs 20 times per second
      // set to 5 for 200 times a second if desired
      delay(50);
    }
    Last edited by Damien; 11-22-2014 at 09:29 AM. Reason: added info

  2. #2
    Junior Member
    Join Date
    Nov 2014
    Posts
    7
    Okay, with some more searching and reading the command line code properly from another post I got it working and I can calibrate and test fine now

    How:
    1. Follow this post (http://forum.pjrc.com/threads/1319-t...ll=1#post14906) and download usbdeview from http://download.cnet.com/USBDeview/3...-10614190.html

    2. From above post in USBDeviw (run in admin mode) sort by vendor ID and then delete any keys/devices that have a vendor ID of 16c0 by right clicking on them and choosing uninstall

    3. Follow this post http://forum.pjrc.com/threads/23566-...ll=1#post30911 and download PsExec from http://technet.microsoft.com/en-au/s.../bb897553.aspx.

    4. In a cmd.exe window (run as administrator) type
    Code:
    [path-to-psexec]\psexec.exe -i -s c:\windows\regedit.exe
    make sure the location you extract the psexec folder to has no spaces in it (i tried for ever to get the above code to work but it wouldnt since my username had a space in it), i recommend extracting it to a folder in the root c drive called 'psexec'

    5. in the reg edit that opens up go to edit/find (or ctrl F) and type in VID_16c0. any keys that pop up that have this near the start need to be deleted. just hit delete on the keyboard and then okay. you will find that there are a whole bunch in a row, once they are all deleted go to edit/find next and repeat this process untill regedit cant find any containing VID_16c0.

    Hope this helps anyone who doesnt read the other posts properly or doesnt understand them properly.
    Note: you might be able to start straight from step 3 but I havent tested that yet.


  3. #3
    Junior Member
    Join Date
    Dec 2018
    Posts
    1
    I know this is a five year old thread, but it's still relevant. Thank you Damien! Your procedure still works under the latest Windows 10 as well. I had exactly the same situation as you described in your first post. Following your instructions along with the referenced threads, I was able to resolve my issue.

    Thanks!

Posting Permissions

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