Jump to content

Recommended Posts

Posted (edited)
Hi guys. i wrote some codes for arduino uno.
I want to simulate switch for DCS.
it is sending key to pc.
for example
.....
buf[2] = 7; // D keycode >> PITCH ATT HOLD
Serial.write(buf, 8); // Send keypress
releaseKey();
delay(vrKeyDelay);
.....
if i set it for Roll - HDG Sel switch, it is working,
but if i set it Pitch - Alt Hold switch it is not moving (if switch position on ALT HOLD or ATT HOLD, it is moving A/P Off state) . when i press 'D' key on keyboard switch is moving.
I test it on BMS it is working on Pitch or Roll switch
 
i will use DCS-Bios but that way easyest to send command to DCS
Unfortunatelly DCS-Bios needs a lot of ports on Arduinio. I am trying decrease count of them
 
Can you help me

8befe4aa-b3fc-4769-89a1-d693249e864c.jpg

Edited by komurcu
Posted

Is that a momentary switch your using there? Does it need to keep the keypress down, rather than release? So the release would only send when it goes back into the center position.

 

I can't remember how that switch works, I'll have to open it up and have a play.

Posted

As far as I'm aware, only a couple of the more obscure Arduinos are capable of working properly as a keyboard.  The usual ones, like Mega, Uno, Nano, etc. have the wrong kind of USB port setup in them.
As for ports, DCS-BIOS uses no more than a keyboard interface would.

Posted
3 hours ago, No1sonuk said:

As far as I'm aware, only a couple of the more obscure Arduinos are capable of working properly as a keyboard.

You're probably talking about the Arduino Leonardo which has the ATmega32U4. This allows it to be plugged directly into a PC and recognised as a USB device.

 

I use the Leonardo exclusively for DCS, and have them show up as joysticks. Each joystick has a number of axises which can be used for potentiometers and around 32 buttons for switches/buttons/rotary encoders. Using this setup I can make each of the functions to whatever is needed in DCS.

 

I also have one Leonardo setup to send keyboard commands which come from a few 3x4 keypads.

  • Like 1
Posted (edited)
On 12/15/2020 at 8:50 AM, komurcu said:
.....
buf[2] = 7; // D keycode >> PITCH ATT HOLD
Serial.write(buf, 8); // Send keypress
releaseKey();
delay(vrKeyDelay);
.....

 

I haven't done anything with DCS Bios, but if you're sending the command via serial then it looks like this might work:

Serial.println("AP_PITCH_SW 2");

 

Otherwise you might be able to use their own commands with :

 

sendDcsBiosMessage("AP_PITCH_SW", "2");

 

I found the F-16 command list here:

https://github.com/DCSFlightpanels/dcs-bios/tree/master/Scripts/DCS-BIOS/doc/json

 

Edited by Savvy
  • Like 1
  • Recently Browsing   0 members

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