Jump to content

Sketch writing help - Arduino 4 DCS-BIOS


Dash_Daddy
 Share

Recommended Posts

Hello community,

 

 

I have been an active DCS World user for some years and have built an A-10 cockpit which is nearing completion - I hope to post some photos soon. The cockpit includes Warthog Hotas, full size ACES II ejection seat replica, rudder pedals, and most of the cockpit panels, housed within the body of the replica fuselage front section. Most panels have working buttons and switches interfaced via pulse generators. Now I have discovered DCS-BIOS - the potential of this would seem to be enormous.

I have an Arduino UNO clone which is up and running -at least the example program "blink" functions as expected. I have made a first attempt at amending the "TemplateSketch" but this was unsuccessful - your help please? I used the IRQ sketch in the BIOS library as no template file as such was present. Having cut and pasted the code for the landing gear LED's the amended sketch does not compile - most likely my mistake as I am a complete novice with DCS BIOS. Seeing the aforementioned potential of DCS BIOS however, I am keen to persevere. I have cut and pasted into the Arduino IDE a separate sketch which does not use DCS-BIOS to control the CMSP - this works and I see the data stream on the serial port, so this indicates my issue is a software problem.

Your advice is welcome - keep it pg please! I would like the text of the working a sketch for comparison, especially to illuminate external LED's of the landing gear in sync with the game itself. With thanks in advance.

Link to comment
Share on other sites

"IRQSerial" is the template you should use (it was named "TemplateSketch" in older versions). I fixed that in the documentation a few weeks ago, but then apparently forgot to update the website (d'oh!).

 

Here's a sketch that should work (it puts the "nose gear safe" light on pin 13, which is connected to the built-in LED on the Uno board):

/*
 Tell DCS-BIOS to use a serial connection and use interrupt-driven
 communication. The main program will be interrupted to prioritize
 processing incoming data.
 
 This should work on any Arduino that has an ATMega328 controller
 (Uno, Pro Mini, many others).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::LED gearNSafe(0x1026, 0x0800, 13);

void setup() {
 DcsBios::setup();
}

void loop() {
 DcsBios::loop();
}

 

Note that I replaced the word "PIN" from the code snippet with the pin number. If you forget this step, the sketch won't compile because the compiler has no idea what "PIN" is.

 

If this doesn't solve your problem, please post the sketch that does not compile here, along with the version of the DCS-BIOS Arduino library you are using and the version of your Arduino IDE.

Link to comment
Share on other sites

Hello Ian,

 

 

Thank you for the impressively fast response - thank you also for the code which I shall cut and paste. Any further issues I shall attempt to include the pertinent details for further assessment and diagnosis. If I can understand DCS_BIOS I think a fully working cockpit is achievable.

Link to comment
Share on other sites

Hello Ian,

 

 

I have copied the sketch you kindly provided into the IDE - it did not compile. The error message was fairly long - once I figure out how to copy it I can post this detail, but for the time being the error message was ... 'setup' is not a member of 'DcsBios' ... I am using Arduino 1.0.6 IDE and library is DCS-BIOS-Arduino-Library- 0.2.11. My computer runs Windows 7 Home premium, if that is relevant.

Link to comment
Share on other sites

Good Afternoon Ian,

 

 

I have installed version 1.8.2 of IDE Arduino as you suggested but still the problem persists. I have changed the zip file DCS_BIOS library to the 'DCS-BIOS Arduino master file' and sadly again the sketch still will not compile. I have tried a little bit of experimentation by including other libraries into a known working sketch (Blink) and the sketch compiles with the addition of any library except DCS-BIOS, the only one I really want! The error message is the same as before of 'setup' etc.. Frustrating, but I am sure once this particular issue is overcome, the effort will be worth it.

Link to comment
Share on other sites

It sounds like the Arduino library is not correctly installed.

 

 

I have changed the zip file DCS_BIOS library to the 'DCS-BIOS Arduino master file'

...and that sentence does not make any sense at all to me.

 

You can install the library like this:

  • Open the Arduino IDE
  • Select Sketch > Include Library > Add .ZIP Library
  • Select dcs-bios-arduino-library-0.2.11.zip

 

Upgrading to a later version works the same, except you have to delete the previous library directory from "Documents/Arduino/libraries" first.

Link to comment
Share on other sites

Yes I too now believe that the issue must be with the library, and probably my installation. My unclear sentence referred to the replacing of the Arduino library 0.2.11 with a file I found on the DCS website entitled DCS BIOS Arduino Library Master File to see if that might help, though done more in hope than expectation. I will delete all DCS BIOS libraries and try to install 0.2.11 according to your instructions - thank you once again.

Link to comment
Share on other sites

All now appears well - thank you for the advice Ian - Within minutes of this software rectification I had a sketch running and giving me three working landing gear lights - fantastic! I will endeavour to keep the community updated with my progress over the coming months as I attempt to get the various cockpit displays and lights working.

Link to comment
Share on other sites

Hello Ian,

 

 

Now the teething problems with libraries are behind me I am pleasantly surprised how quickly you can get hardware up and running with DCS_BIOS. I now have working gear lights, master caution, nose-wheel steering, missile warning light and others! I am running these from a single Arduino UNO clone but am running out of pins. Accordingly, I have connected a second working UNO clone (one from China - working after a search to find the appropriate driver). Question - I am guessing that you need a separate "connect serial port" window open and running for each Arduino board as you play DCS? My first Arduino runs on my system on Com3. The pop up window, which appears when the "connect serial port" is run, is slaved to this port. The problem is that my second Arduino is on Com4 on my PC, and I do not know how to tell the computer to "connect serial port" to this second port, Com4 rather than Com3.

Impressed with DCS BIOS and beginning to discover first hand its very real potential as I begin to get to grips with it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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