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

Thread: T2.0 newbie help for flight controller button box

  1. #1

    T2.0 newbie help for flight controller button box

    I am starting to put together a button box as a controller for DCS World flight sim, I have a Teensy 2.0, about 25 switches (needing a button matrix approach) some pots and rotary encoders. Its not clear to me exactly what pins I can use on the T2 and for what purposes. If I go for 25 switches and a 5 x 5 matrix then I need 10 pins but I then need to leave some available for the rotary encoders (assume thats pins 5 - 8?) and analog reads for the pots?
    When I connect rotary encoders they run fine in one of the example programs but as soon as I try to get Windows joystick controller to recognise the outputs the rotaries are very jittery and often fire off other buttons while being turned. How can I clean up the signals so I can map controls to them in DCS? (thinking of non-critical mapping like radio volumes, lighting levels, etc)?
    Thx!

  2. #2
    On the Teensy 2.0 I have pins 0 to 23, then theres 2 pins for GND and 2 pins for +5v, and a reset. Can I use all pins 0 - 23 for digital switches? But then only pins 5 to 8 for interrupt polling (rotary enc.) and any pins A0 to A11 (pins 11 to 22) for analog input - is that correct?

  3. #3
    Senior Member
    Join Date
    May 2017
    Posts
    106
    Quote Originally Posted by Sprool View Post
    On the Teensy 2.0 I have pins 0 to 23, then theres 2 pins for GND and 2 pins for +5v, and a reset. Can I use all pins 0 - 23 for digital switches? But then only pins 5 to 8 for interrupt polling (rotary enc.) and any pins A0 to A11 (pins 11 to 22) for analog input - is that correct?
    I think you are right.
    But you have one more digital pin 24, also useable for interrupts.

  4. #4
    is that the one labelled E6, just in from B3? Its all quite confusing, the pin 21 is labelled as F0, 20 = F1 then 19 = F4, what happened to F2 and F3?

  5. #5
    Will I be ok using the HelloKeypad example but inserting a bigger matrix for my button presses to be picked up by windows joystick controller? I'm looking at 5 x 6 button matrix, I dont need to assign characters or serial print them, having the little LED flashing as confirmation of a button press would be useful?

  6. #6
    Senior Member
    Join Date
    May 2017
    Posts
    106
    Quote Originally Posted by Sprool View Post
    is that the one labelled E6, just in from B3? Its all quite confusing, the pin 21 is labelled as F0, 20 = F1 then 19 = F4, what happened to F2 and F3?
    YES, Pin 24 is labled E6 on PCB.
    It seems confusing because Teensy2.0 is an old 8bit-AVR product. Introduced before IDE Teensyduino come. The F2 and so on are the values for die C compiler without IDE. Simply look here https://www.pjrc.com/teensy/pinout.html for Pin Assignments, Using Arduino Software.

  7. #7
    Thx Larry but I have that diagram already and its certainly not very clear to me - the later models with colour coding of the various pin areas seem a bit more intuitive but the 2.0 documentation is sparse and lacks much clarity for a newbie like me. Theres also some refs to not using pin 11 as its needed for the LED - what if I dont need the LED? So many questions!

  8. #8
    Some progress made - I increased the keypad button matrix to 4 x 6, avoided pin 11, added a little routine for the internal LED to flash whenever a button is pressed, wired up the button matrix, and all prints fine to serial, but joystick controller not picking anything up.
    I new need to assign each button keypress to a joystick button.
    Any help in how to do that?
    Puurleease!

  9. #9
    OSrted, thanks to info in this post: https://forum.pjrc.com/threads/53015...ing-key-matrix

Posting Permissions

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