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

Thread: Teensy 2.0 as joystick not working

  1. #1
    Junior Member
    Join Date
    Nov 2017
    Location
    Denmark
    Posts
    4

    Teensy 2.0 as joystick not working

    Hi!

    I just received a Teensy 2.0 today, and downloaded the Teensyduino installer, and succeeded to upload the fast/slow blink sketches from Arduino IDE 1.8.5.
    I then tried to follow this guide: https://www.pjrc.com/teensy/td_joystick.html

    The Arduino IDE does not have a Joystick option under Tools > USB Type. I only have a Keyboard + Mouse + Joystick option, so I selected that.
    The Board is set to Teensy 2.0. The CPU speed is set to 16 MHz

    I then tried this sketch:
    Code:
    int led = 11;
    
    void setup() {
      pinMode(led, OUTPUT);
    }
    
    void loop() {
      Joystick.X(512);            // "value" is from 0 to 1023
      Joystick.Y(512);            //   512 is resting position
      
      digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
      Joystick.button(1, 1);
      delay(1000);               // wait for a second
      digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
      Joystick.button(1, 0);
      delay(1000);               // wait for a second
    }
    When the sketch is uploaded I do get a Teensy Keyboard/Mouse/Joystick device on Win7 under Devices and Printers, but the Properties of the Game controller settings of the Teensy device indicates that it doesn't work:

    Click image for larger version. 

Name:	TeensyGamepad.png 
Views:	24 
Size:	29.0 KB 
ID:	12063

    What am I doing wrong?

    /Mogens

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,385
    FWIW, your sketch worked for me on T2.0 hooking to Win 10. joystick properties shows button toggling. If i replace 512 with analogRead(A0) and analogRead(A1) (unattached, yields random), i can see that cross-hair randomly moving ...
    Using Arduino 1.8.4/1.40

    do you have genuine PJRC T2.0 or counterfeit? (have photo?)

  3. #3
    Junior Member
    Join Date
    Nov 2017
    Location
    Denmark
    Posts
    4
    It's most likely a counterfeit board then...

    Click image for larger version. 

Name:	IMG_2913r.jpg 
Views:	14 
Size:	61.9 KB 
ID:	12065

    /Mogens

  4. #4
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,385
    yep, looks counterfeit. silkscreen doesn't match https://www.pjrc.com/teensy/pinout.html

  5. #5
    Junior Member
    Join Date
    Nov 2017
    Location
    Denmark
    Posts
    4
    Well.. I'm curious.
    What is the difference between a genuine and a counterfeit board?
    I mean provided that the counterfeiters got the PCB layout right, what's left to differ?
    Does the chip contain any code that only PJRC has access to?

    /Mogens

  6. #6
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,385
    see https://www.pjrc.com/teensy/counterfeit.html
    and search forum for "counterfeit" and you can compile a list of the many sketches that won't work.

  7. #7
    Junior Member
    Join Date
    Nov 2017
    Location
    Denmark
    Posts
    4
    Well, thanks. I better get me a genuine one then.

    /Mogens

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,022
    That board is definitely a counterfeit. But if the code uploads, I can't understand why it wouldn't work, unless there's something seriously wrong with the hardware.

Posting Permissions

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