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

Thread: Teensy Game Controller

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    4

    Question Teensy Game Controller

    I am currently working on a project and interested in using the teensy to create a game controller for disabled gamers. i was wondering if the teensy be used to create a game controller similar to an xbox controller for pc (including all the buttons, analogs, ect). if so how can i program the separate analog thumb sticks so that one controls looking and one control's movement. and hwo can i program the bottons ( a link to an existing project would also help). the analog sticks are the most important part of my inquiry. Thanks in advance.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,176
    You should probably start with the Joystick example. In Arduino, open it with File > Examples > Teensy > USB_Joystick > Complete.

    It already has code using analogRead(). For the joystick part you mentioned in 2 threads earlier today

    http://forum.pjrc.com/threads/23592-...ysticks-Teensy
    http://forum.pjrc.com/threads/23591-...ysticks-Teensy

    just connect the pot for each axis to an analog pin.

    Each pot as 3 wires. Connect the center wire to the analog input pin. Connect the other 2 wires to GND (AGND if using Teensy 3.0) and 5V (if using Teensy 2.0) or 3.3V (if using Teensy 3.0). If you use a voltmeter, you can see the voltage change on the middle pin as the joystick moves. Likewise, analogRead() will measure the voltage and give you a number.

    Start with that joystick example and get it working with your PC, then modify to suit your needs.

  3. #3
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Thanks Paul. your reply and time has been very helpful. you probably noticed that i'm a noob with all this, but i am willing to learn.

  4. #4
    I created a joystick controller using 3 axis and a few buttons. It has automatic calibration, and dead zone detection.

    https://github.com/dc740/Game-port-t...tick-converter


    I used Teensyduino, so you can use it on Teensy 2.0 or Teensy 3.0.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,176
    Do you have any photo of this project? If so, I could post it to the Teensy Projects page.

  6. #6
    The teensy is not visible, so I didn't take a picture, but it's this controller with a USB connector instead of the game port connector.

    Click image for larger version. 

Name:	6466576_4_644x461_joystick-genius-maxfighter-f16-electronice-si-electrocasnice.jpg 
Views:	400 
Size:	21.0 KB 
ID:	700
    like:
    Name:  Genius_F-16U.jpg
Views: 5873
Size:  12.0 KB
    but with several extra features.

Tags for this Thread

Posting Permissions

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