LewisR Posted September 6, 2024 Posted September 6, 2024 Hi all, I’m building a button box for the F14 RIO seat. I found out after writing sketches that I can’t have buttons on my master board, but want to know if I can connect things like LEDs. I’m assuming because the board can read data to send across the RS485, it will be able to get the dcs bios messages for LEDs. I’m also hoping that, if it can, I can get the information for things like current selection on the CAP panel, fuel state, etc. Any one got any experience in this particular area? Cheers, LR
LewisR Posted September 6, 2024 Author Posted September 6, 2024 6 minutes ago, pesbra said: Not sure what you mean by not being able to have buttons. I’ve done them on the Mega without issues. Same with LEDs. I’ll be happy to help but need to understand better what you are trying to do. When writing the sketches, I had the Mega as the master and two Nano's in daisy chain as slaves. The Mega had a rotary encoder written into the loop but couldn't compile. Came across this post: that states it is not possible to have buttons/encoders/etc directly fed into the Mega. When the Mega is the master it can only do that job, for DCS at least. I am taking that thread at face value and have had to do a 5x6 matrix to fit all my desired buttons on one Nano, and have the encoders and toggles on the other. I want to have LEDs for the IROT and ANT TRK from the DDD. So what I am asking is: Although the Master cannot write to DCS, can it read the out puts from DCS BIOS and send them to LEDs that are connected directly to the board? Hope this clears it up a bit. Cheers, LR
pesbra Posted September 6, 2024 Posted September 6, 2024 This is certainly beyond my experience, but now you peaked my curiosity. I’m gonna give this a try
LewisR Posted September 6, 2024 Author Posted September 6, 2024 (edited) For additional context, the sketch I had an issue with compiling looked something like this (not exact as I have since deleted the original.): #define AZSELECT_PIN A0 #define ELVBAR_PIN A1 long oldPosition1 = 0; long oldPosition2 = 0; void setup() { // Initialize DCS-BIOS DcsBios::setup(); } void loop() { // Update DCS-BIOS DcsBios::loop(); // Read new positions long newPosition1 = analogRead(AZSELECT_PIN); if (newPosition1 != oldPosition1) { if (newPosition1 > oldPosition1) { DcsBios::sendDcsBiosMessage("RIO_RADAR_AZI_SCAN", "+1"); } else { DcsBios::sendDcsBiosMessage("RIO_RADAR_AZI_SCAN", "-1"); } oldPosition1 = newPosition1; } long newPosition2 = analogRead(ELVBAR_PIN); if (newPosition2 != oldPosition2) { if (newPosition2 > oldPosition2) { DcsBios::sendDcsBiosMessage("RIO_RADAR_ELE_BARS", "+1"); } else { DcsBios::sendDcsBiosMessage("RIO_RADAR_ELE_BARS", "-1"); } oldPosition2 = newPosition2; } } Of course I had all the required libraries and stuff included at the top (DCS BIOS, RS485 Master, etc) 21 minutes ago, pesbra said: This is certainly beyond my experience, but now you peaked my curiosity. I’m gonna give this a try I appreciate the honesty, I'd never attempted anything like this before so am learning both Arduino and DCS BIOS at once. It's good fun but it was disheartening to read the linked thread after writing and trying to debug all my scripts and having issues. Edited September 6, 2024 by LewisR Old unused code included.
No1sonuk Posted September 7, 2024 Posted September 7, 2024 Reading and keeping track of switches is probably too much extra for the Master to handle. LED outputs are far less demanding of resources, so it might be possible. OTOH, the Master code might have the other functions disabled.
LewisR Posted September 7, 2024 Author Posted September 7, 2024 5 hours ago, No1sonuk said: Reading and keeping track of switches is probably too much extra for the Master to handle. LED outputs are far less demanding of resources, so it might be possible. OTOH, the Master code might have the other functions disabled. I’m not at all familiar with Arduino or DCS BIOS, but from the linked thread above and the fact that ChatGPT (I was trying to trouble shoot this issue) believed it should work, but was using a RS485 library from the library manager, I feel like maybe it’s more to do with the way DCS is set up to accept messages. In the .h source files for both DCS BIOS and its internal RS485 master function, the sendDcsBiosMessage and tryToSendDcsBiosMessage functions are specifically set to not work if the master module is called. I wonder if it would be possible using a third party RS485 module rather than the one DCS includes, but am not familiar enough to know whether that would affect the messages two and from the slaves.
No1sonuk Posted September 7, 2024 Posted September 7, 2024 Yeah. If sendDcsBiosMessage and tryToSendDcsBiosMessage are disabled, switch inputs to DCS aren't going to work. My limited grasp of the Arduino code indicates that the data parser isn't included when the RS485 Master code is active. If that's the case, the Master can only act as a data router, and not do anything with the data itself. I think the only way we'll know for sure is if someonme tries it. I don't have the setup to do that myself right now.
Recommended Posts