komurcu Posted December 14, 2020 Posted December 14, 2020 (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 Edited December 14, 2020 by komurcu
Savvy Posted December 15, 2020 Posted December 15, 2020 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.
komurcu Posted December 15, 2020 Author Posted December 15, 2020 yes i recognized it. but if i use real keybord and press (and release) 'G' it is working correctly. i could not understand why.
No1sonuk Posted December 15, 2020 Posted December 15, 2020 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.
Savvy Posted December 16, 2020 Posted December 16, 2020 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. 1
Savvy Posted December 16, 2020 Posted December 16, 2020 (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 December 16, 2020 by Savvy 1
komurcu Posted December 17, 2020 Author Posted December 17, 2020 thanks i will check. is there any documantary which i can read for more data. because of some jsons are empty
Recommended Posts