Jump to content

Alternatives to using an endless amount of Leo Bodnar boards?


obious

Recommended Posts

just some code. Although I know how to do simple things with an arduino, writing 'game controller code' must be different , right? 

First, did you use encoders or pots for your dials? How many did you get per teensy? 

Second , when you read the data from the pin for a particular dial, for example, what do you do with it? It's not like you are going to process the input and activate an output pin on the arduino. How do you assign that value to a variable which the pc will recognize as an axis? Maybe I could see a snippet of code?

 

Finally, I can only find teensy 4.1, teensy 2 and teensy LC boards.

4930K @ 4.5, 32g ram, TitanPascal

Link to comment
Share on other sites

On 3/29/2022 at 4:06 PM, skypickle said:

what do you folks like for potentiometers? With the numerous dials and sliders in an aircraftfor lights, I need to build something. Since radio shack closed, I have no easy access to hardware and have to order online. What electrical specifications are required? Which pots have the smoothest and damped feel? 

I use 10K linear potentiometers

Link to comment
Share on other sites

On 3/30/2022 at 7:44 PM, skypickle said:

just some code. Although I know how to do simple things with an arduino, writing 'game controller code' must be different , right? 

First, did you use encoders or pots for your dials? How many did you get per teensy? 

Second , when you read the data from the pin for a particular dial, for example, what do you do with it? It's not like you are going to process the input and activate an output pin on the arduino. How do you assign that value to a variable which the pc will recognize as an axis? Maybe I could see a snippet of code?

 

Finally, I can only find teensy 4.1, teensy 2 and teensy LC boards.

Encoders are really just toggles.  One for clockwise, one for counter (or anti, but not ante) clockwise, one for push.  The problem with this is a single encoder click may be several button pushes.  I think there's a way to fix that in code, but I haven't bothered yet.

For pots I used 10k Alpha potentiometers, but I'm going to upgrade those to hall devices on the next iteration

Switches are all NKK, and they do make a 1P3T, which is a three position switch and very, very nice.  Think FULL/HALF/AUTO flaps on the F-18.  On the SPDT both positions are 'on' and have a switch number.

So, here's a snippet:

#include <Keypad.h>

#define NUM_BUTTONS 56

//  Which pins I have attached to my buttons
// (Almost) all buttons on a Teensy 3.6 (missing 38 and 39 because they're analong):
int buttonList[NUM_BUTTONS] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57};

const byte ROWS = 4;
const byte COLS = 3;

byte rowPins[ROWS] = {40,41,42,43}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {49,50,51}; //connect to the column pinouts of the keypad

char keyMap[ROWS][COLS] = {
{80,81,82},
{83,84,85},
{86,87,88},
{89,90,91}
};

Keypad kpd = Keypad( makeKeymap(keyMap), rowPins, colPins, ROWS, COLS); 

void setup() {
  // put your setup code here, to run once:
  Joystick.useManualSend(true);
  
  //Declare button pins as input with the internal pullup resistor on
  for (int i = 0; i < NUM_BUTTONS; i++)  {
    pinMode(buttonList[i], INPUT_PULLUP);
  }

}

void loop() {
  // analog pins...
  Joystick.X(analogRead(A19) * 64);
  Joystick.Y(analogRead(A20) * 64);
  Joystick.Z(analogRead(A21) * 64);
  Joystick.Xrotate(analogRead(A22) * 64);
  
  // Check for digital buttons not in the keypad
  for (int i = 0; i < NUM_BUTTONS; i++) {
    if (digitalRead(buttonList[i]) == HIGH) {  //Check to see if pin is HIGH
      Joystick.button(i + 1, 0);  //If pin is HIGH, button isn't pressed, so send 0
    } else {
      Joystick.button(i + 1, 1);  //If pin is LOW, button is pressed, so send 1
    }
  }

  // Get keypad data
  if ( kpd.getKeys() )
  {
    for (int i=0; i<LIST_MAX; i++)
    {
      if ( kpd.key[i].stateChanged )
      {
        if ( kpd.key[i].kstate == PRESSED || kpd.key[i].kstate == HOLD)
        {
            Joystick.button(kpd.key[i].kchar, 1);
        } else if ( kpd.key[i].kstate == RELEASED ){
            Joystick.button(kpd.key[i].kchar, 0);
        }
      }
    }
  }

  Joystick.send_now();  //Send control states
  delay(5);  //Slow things down a bit

}

 

Link to comment
Share on other sites

19 hours ago, Raisuli said:

Switches are all NKK, and they do make a 1P3T, which is a three position switch and very, very nice.  Think FULL/HALF/AUTO flaps on the F-18.  On the SPDT both positions are 'on' and have a switch number.

 

If you're using an Arduino as a HID, you can program a centre-off switch to send a "virtual" button press when the two inputs are off.
And if you're using DCS-BIOS, you can use the "sendDcsBiosMessage" function in a similar way.

Link to comment
Share on other sites

19 hours ago, No1sonuk said:

If you're using an Arduino as a HID, you can program a centre-off switch to send a "virtual" button press when the two inputs are off.
And if you're using DCS-BIOS, you can use the "sendDcsBiosMessage" function in a similar way.

I just use a three position switch.  That puts less software between my device and success.

That's not supposed to be snark at all; there's so much toxic bickering on these boards I feel the need to include a disclaimer!  I realize there are software options to use single throw switches to act like dual throw.  My Thrustmaster throttle does that, which is a big part of the reason I don't use any of those switches  🙂

My goal is "works".  I'm about 90% successful with that (one of my devices is currently seen by everything but DCS), and I don't want to depend on a software layer on the machine to make that happen.

Link to comment
Share on other sites

I'm using Pokeys 57U for all my cockpit electronics (my HOTAS use canabilzed TM electronics to be fully TARGET compatible). In my opinion the best card you can get for such a project. It can be programmed with DX buttons or keyboard macros. The programming can be stored as a file, so that different programmings are possible. It has 55 inputs, supports 6 pots, rotary encoders, switches, buttons and so on. I can make different functions for keypress or release and also has a support for a 128er matrix if 55 functions aren't enough. You can even program the axis of the pots with additional functions.

No code fidelling, firmware built or anything else. There is simple GUI to adjust all you want.

Here is the manual of it for further details. I always use the one without terminals, cause I don't like small wires screwed in terminals. A loose connection is preprogrammed (even with connectors). Mostly I only solder the board once to the part I want to built and never remove it. The ones without terminals are also a little cheaper 😅.

https://www.poscope.com/wp-content/uploads/downloads/Pokeys/Manuals/PoKeys user manual (19.8.2017).pdf


Edited by Viper1970
  • Like 1

CockpitPC1: R9 5950X|64GB DDR4|512GB M2SSD|2TB M2SSD|RTX3090|ReverbG2|Win11Pro - PC2: PhnIIX6 1100T|32GB DDR2|2x2TB HDD|2x GTX660 SLI|Win7Pro64
ComUnitPC1: R9 3900XT|32GB DDR4|2x2TB HDD|RTX2070|Win11Pro - PC2: PhnIIX6 1100T|16GB DDR2|2x2TB HDD|GTX660|Win7Pro64
ComUnitPC3: AthlnIIX2 250|2GB DDR2|2TB HDD|5950Ultra|2xVoodooII SLI|WinXPPro32&WinME - PC4: K6-2+|768MB SDR|640GB HDD|Geforce256DDR|VoodooI|Win98SE

DCS - Modules - 1.jpg

DCS - Modules - 2.jpg

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...