Using Teensy 3.1 as joystick, not showing up as game controller

Status
Not open for further replies.

lionstatic

New member
I've recently migrated from a Teensy 3.0 to a Teensy 3.1 board. I had written a sketch for the Teensy 3.0 board that obtains data from a Wii Nunchuk using I2C (communicating via pins 18 & 19, with pullup resistors to 3.3V). Below is the basic outline of my sketch:

Code:
#include <i2c_t3.h>

#define NUNCHUCK_ADDRESS 0x52

uint led_count;
    
void setup()
{
  pinMode(13, OUTPUT);
  pinMode(14, OUTPUT);
  led_count = 0;
  Joystick.useManualSend(true);
  Wire.begin();
  SendByte(0x55, 0xF0);
  SendByte(0x00, 0xFB);
  
}

void loop()
{
  int count = 0;
  int values[6];

  Wire.requestFrom(NUNCHUCK_ADDRESS, 6);

  while(Wire.available())
  {
    values[count] = Wire.read();
    count++;
  }

  ... More Code here to process the data from the device ...
    
  Joystick.sliderLeft(analogX+512);
  Joystick.Zrotate(analogX+512);
  Joystick.sliderRight(analogY+512);
  Joystick.X(accelX);          
  Joystick.Y(accelY);           
  Joystick.Z(accelZ);
  Joystick.button(1, zButton);
  Joystick.button(2, cButton);
  Joystick.hat(hatAngle);
  Joystick.send_now();
    
  SendByte(0x00, 0x00);
    
  if (zButton > 0 || cButton > 0)
    digitalWrite(14,HIGH);
  else
    digitalWrite(14,LOW);
  
  if (led_count < 20)
    digitalWrite(13,HIGH);
  else
  {
     digitalWrite(13,LOW);
     if (led_count > 30)
       led_count = 0;
  }
  
  led_count++;
  delay(10);
}

void SendByte(byte data, byte location)
{
  Wire.beginTransmission(NUNCHUCK_ADDRESS);
  Wire.write(location);
  Wire.write(data);
  if ( Wire.endTransmission() > 0)
  {
    //Do something
  }
}

After resolving a compilation error that was occurring from the included i2c_t3 library (from help on this thread), I uploaded the sketch to my Teeny 3.1 (after choosing "Serial/Keyboard/Mouse/Joystick" in Tools>>USB Type in the Arduino environment). However, when I opened the Windows Game Controllers Control Panel (joy.cpl), the device was not showing up.

Unsure if there was a hardware or software problem, I connected the board in parallel with the Teensy 3.0 board (with the clock and data wires connected to both the Teensy 3.0 and 3.1 boards). I then uploaded the same sketch to each. The Teensy 3.0 board showed up in the Game Controllers Control Panel and was receiving/processing the data correctly, the Teensy 3.1 did not even show up.

I tried reinstalling the Arduino environment, as well as the Teensyduino uploader.

Any thoughts on what I'm doing wrong? Am I missing a driver of some kind for the Teensy 3.1?
 
Last edited:
I also just tried sending the data over USB via Serial, replacing the Joystick code with Serial prints:

Code:
    Serial.print(analogX, DEC);
    Serial.print(' ');
    Serial.print(analogY, DEC);
    Serial.print(' ');
    Serial.print(accelX, DEC);
    Serial.print(' ');
    Serial.print(accelY, DEC);
    Serial.print(' ');
    Serial.print(accelZ, DEC);
    Serial.print(' ');
    Serial.print(zButton, DEC);
    Serial.print(' ');
    Serial.print(cButton, DEC);
    Serial.print(' ');
    Serial.println(hatAngle, DEC);

I then selected "Serial" in Tools>>USB Type.

When I did that, compiled, uploaded, and then opened the Serial monitor, I could see that the data was being sent correctly.
 
Possible Solution

I am having the same problem, joystick not showing up as game controller
On my Windows 7 development machine. On another Windows 7 PC the Teensy 3.1 is working as expected.

This thread might help
http://forum.pjrc.com/threads/23566-Teensyduino-USB-Joystick-no-data-driver-problem-workaround

Short version of fix
--------------------
Delete from the registry all keys containing VID_16c0.

I have not deleted the keys yet so I cant confirm it will work.
 
Status
Not open for further replies.
Back
Top