Texas_Mike
New member
Back Story: After several years of designing the mechanical aspects of a universal DIY cockpit simulator, that attaches to any pneumatic piston executive office chair, I'm ready to tackle the basic joystick coding. My mechanically redesigned Thrustmaster HOTAS X PS3 joystick has a 12" extension tube added between the joystick base and hand grip. This extension greatly increases the pilot's bio-mechanical input precision. It also amplifies the Thrustmaster dead zone coding, so the centered hand grip dead zone, easily occupies a 3 1/2" hand grip travel area.
So I've turned to Teensy and the various joystick coding examples. I'm a noob (as you have guessed) and have pieced together two versions of similar code that almost work. I am slowly learning. Any help would be most appreciated by me and your assistance will be very appreciated by others, when I publish on Instructables.com later this year. There are a lot of flight sim builders and users out there, looking for inexpensive equipment setups that deliver higher price tag precision performance.
I complied the two codes using Arduino IDE 1.8.13 and Teensyduino 1.53.
The code was configured to run on;
Board: "Teensy 3.2/3.1"
USB Type: "Keyboard + Mouse + Joystick"
CPU Speed: "96 MHZ (overclock)"
Optimize: "Faster"
Testing is done on Windows 8.2. Will test on Windows 7 and 10 later.
Note: I added a 0.1uF 50V Ceramic Disc Capacitor (six total) to each pin of the six analog inputs (A0 thru A5). Also, A4 is not connected to a pot but has a lead wire with capacitor for future usage. This has all been soldered onto a small perf board and there doesn't seem to be any opens or shorts.
I have deliberately stayed away from changing any Arduino or Teensy files to make it easier for others to replicate my results, in the future.
Code version #1 includes Bounce.h and it almost works. Everything looks ok in joy.cpl but in "World of Warplanes", my guns (button #1 on 3.2 Teensy digital pin #0) jam sporadically. There doesn't seem to be an observable timing pattern to their jamming or un-jamming. Opening and closing the trigger (button #1), doesn't always resume the gun action. Maneuvering the aircraft (slewing pot axes) seems to make button#1 open sooner but it will still open without slewing the pots. When the button opens, my keyboard "spacebar" still activates the game's aircraft guns without regard to my pot slewing. This seems to be the only problem with version #1.
Note that in both code versions I have commented out (//) the hat switch codes for 45, 135, 225 and 315 degrees, because I couldn't get the Thrustmaster hat switch to read two hat buttons at once. I have an old TM hat switch and plan on examining it closely to determine if it is a 4-way or 8-way mechanical design. The TM hand grip is a PS3 HOTAS X.
Code version #2 does not include Bounce.h and it doesn't pass the joy.cpl test for various reasons, although the pots do slew and buttons 1 thru 10 (D0 thru D9) light up.
1 - The onboard Teensy 3.2 LED is dimly lit. This isn't the case with code version #1.
2 - Button #14 according to joy.cpl is constantly lit. This isn't the case with code version #1. I only have 10 buttons (D0 thru D9) plus the 4 buttons in the hat switch (D20 thru D23) hooked up.
3 - The "HU" arrow is always lit on the hat indicator of joy.cpl and doesn't change when operating the hat switch. In version #1 in joy.cpl, "HU" would only have an arrow when "HU" button D20 was pushed.
Thanks ahead of time for any assistance.
Both codes are below as well as a CAD PDF of the 3.2 Teensy and HOTAS X wiring schematic.
So I've turned to Teensy and the various joystick coding examples. I'm a noob (as you have guessed) and have pieced together two versions of similar code that almost work. I am slowly learning. Any help would be most appreciated by me and your assistance will be very appreciated by others, when I publish on Instructables.com later this year. There are a lot of flight sim builders and users out there, looking for inexpensive equipment setups that deliver higher price tag precision performance.
I complied the two codes using Arduino IDE 1.8.13 and Teensyduino 1.53.
The code was configured to run on;
Board: "Teensy 3.2/3.1"
USB Type: "Keyboard + Mouse + Joystick"
CPU Speed: "96 MHZ (overclock)"
Optimize: "Faster"
Testing is done on Windows 8.2. Will test on Windows 7 and 10 later.
Note: I added a 0.1uF 50V Ceramic Disc Capacitor (six total) to each pin of the six analog inputs (A0 thru A5). Also, A4 is not connected to a pot but has a lead wire with capacitor for future usage. This has all been soldered onto a small perf board and there doesn't seem to be any opens or shorts.
I have deliberately stayed away from changing any Arduino or Teensy files to make it easier for others to replicate my results, in the future.
Code version #1 includes Bounce.h and it almost works. Everything looks ok in joy.cpl but in "World of Warplanes", my guns (button #1 on 3.2 Teensy digital pin #0) jam sporadically. There doesn't seem to be an observable timing pattern to their jamming or un-jamming. Opening and closing the trigger (button #1), doesn't always resume the gun action. Maneuvering the aircraft (slewing pot axes) seems to make button#1 open sooner but it will still open without slewing the pots. When the button opens, my keyboard "spacebar" still activates the game's aircraft guns without regard to my pot slewing. This seems to be the only problem with version #1.
Note that in both code versions I have commented out (//) the hat switch codes for 45, 135, 225 and 315 degrees, because I couldn't get the Thrustmaster hat switch to read two hat buttons at once. I have an old TM hat switch and plan on examining it closely to determine if it is a 4-way or 8-way mechanical design. The TM hand grip is a PS3 HOTAS X.
Code version #2 does not include Bounce.h and it doesn't pass the joy.cpl test for various reasons, although the pots do slew and buttons 1 thru 10 (D0 thru D9) light up.
1 - The onboard Teensy 3.2 LED is dimly lit. This isn't the case with code version #1.
2 - Button #14 according to joy.cpl is constantly lit. This isn't the case with code version #1. I only have 10 buttons (D0 thru D9) plus the 4 buttons in the hat switch (D20 thru D23) hooked up.
3 - The "HU" arrow is always lit on the hat indicator of joy.cpl and doesn't change when operating the hat switch. In version #1 in joy.cpl, "HU" would only have an arrow when "HU" button D20 was pushed.
Thanks ahead of time for any assistance.
Both codes are below as well as a CAD PDF of the 3.2 Teensy and HOTAS X wiring schematic.