Jump to content

Recommended Posts

Posted

Hello all

 

have been busy with interfacing my F/A18C cockpit. I run DCS BIOS with Arduino mega boards

 

Now I try to connect a 10k potentiometer. Connected black to GND, red to 5V and yellow to an analog pin.

 

Copied the code from DCS BIOS and assigned the correct PIN number to the pot.

 

This doesn't seems to work. Do I have to add something? Same story for the servo's. Does it require an additional piece of code.

 

Thanks

Posted

Your wiring sounds ok. The potentiometer should work without additional code; the servo needs the servo.h library. Maybe you could post your code? Have you tried it on one or several megas? Some of them seem to have problems with DCS-BIOS.

Greetings

Posted

I never used DCS BIOS but did some stuff with Arduino and X-Plane.

Did you use any Arduino Serial Output or Display to monitor the Arduino inputs?

Most of the time it was a problem with my Arduino internal calculations rather than the interface to X-Plane

Posted

I always look first in the Arduino ide on the serial monitor and then on the terminal output from dcs-bios. You must see in booth something. There's a Browser-Plugin to check the communication between dcs and dcs-bios.

If you soldering the Poti perhaps the pin is broken internal.

 

Gesendet von meinem Pixel 3 XL mit Tapatalk

my tutorial for dcs-bios, multimonitorsetup with a JF-17

https://github.com/shadowframe/jf17_multimonitor

 

discord shadowframe#7916

Posted
Hello all

 

have been busy with interfacing my F/A18C cockpit. I run DCS BIOS with Arduino mega boards

 

Now I try to connect a 10k potentiometer. Connected black to GND, red to 5V and yellow to an analog pin.

 

Copied the code from DCS BIOS and assigned the correct PIN number to the pot.

 

This doesn't seems to work. Do I have to add something? Same story for the servo's. Does it require an additional piece of code.

 

Thanks

 

Hello,

 

do you need for the servo additional code. You need mapping for the servo. For example the servo has been a range from 544 to 2400. From DCS Bios come a value from 0 to 64.000. You tell the servo, what is the right position, when comes the value 45.000.

 

 

Sky...

Posted

Hello,

 

focussing on the servo problem for now: got the library servo.h installed and the sketch succesfully uploaded to the board. Did not change the values but still nothing is happening.

 

My code is here (F/A18C E volts gauge)

 

 

Can someone perhaps show their code as an example?

 

 

Many thanks in advance

 

 

#include <Servo.h>

 

 

 

/*

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 lhAdvNoGo(0x740a, 0x0020, A0);

DcsBios::LED lhAdvGo(0x740a, 0x0010, A1);

DcsBios::LED lhAdvRBleed(0x7408, 0x1000, A2);

DcsBios::LED lhAdvLBleed(0x7408, 0x0800, A3);

DcsBios::LED lhAdvStby(0x7408, 0x4000, A4);

DcsBios::LED lhAdvSpdBrk(0x7408, 0x2000, A5);

DcsBios::LED lhAdvRec(0x740a, 0x0001, A6);

DcsBios::LED lhAdvLBarRed(0x7408, 0x8000, A7);

DcsBios::LED lhAdvXmit(0x740a, 0x0004, A8);

DcsBios::LED lhAdvLBarGreen(0x740a, 0x0002, A9);

DcsBios::LED lhAdvAspjOh(0x740a, 0x0008, A10);

DcsBios::LED masterCautionLt(0x7408, 0x0200, A11);

DcsBios::Switch2Pos masterCautionResetSw("MASTER_CAUTION_RESET_SW", A12);

DcsBios::LED fireExtBtn(0x740e, 0x0001, A13);

 

DcsBios::Switch2Pos ifeiModeBtn("IFEI_MODE_BTN", 53);

DcsBios::Switch2Pos ifeiQtyBtn("IFEI_QTY_BTN", 52);

DcsBios::Switch2Pos ifeiUpBtn("IFEI_UP_BTN", 50);

DcsBios::Switch2Pos ifeiDwnBtn("IFEI_DWN_BTN", 51);

DcsBios::Switch2Pos ifeiZoneBtn("IFEI_ZONE_BTN", 49);

DcsBios::Switch2Pos ifeiEtBtn("IFEI_ET_BTN", 48);

 

DcsBios::Switch3Pos selectHmdLddiRddi("SELECT_HMD_LDDI_RDDI", 46, 47);

DcsBios::Switch3Pos selectHudLddiRddi("SELECT_HUD_LDDI_RDDI", 44, 45);

DcsBios::Switch3Pos modeSelectorSw("MODE_SELECTOR_SW", 42, 43);

DcsBios::PotentiometerEWMA<5, 128, 5> ifei("IFEI", A15);

 

DcsBios::ServoOutput voltE(0x752e,2, 544, 2400);

 

void setup() {

DcsBios::setup();

}

 

void loop() {

DcsBios::loop();

}

Posted (edited)

Hey,

 

Ok, as I have already written, you have to tell the servo what to do when.

A servo is a motor that uses a potentiometer to determine its position and then move to the desired position.

 

In your sketch you only said which area your servo can drive. But you didn't say when to take which position.

 

 DcsBios::ServoOutput voltE (0x752e,2, 544, 2400, [](unsigned int newValue) -> unsigned int {
   return map(newValue, 0, 43089, 544, 2400);
 });

 

You have to map it.

In my exemple.: If the DCS value is 0, please go to position 544. If the value is 43089, then go to position 2400.

 

You have to find the right values yourself so that your pointer also shows the correct position.

 

Sky...

Edited by SkyJunky
Posted

Hi ..

 

 

Try adding #include "Wire.h" to get the Pots working.

 

 

I also use a 2 x Megga on F18, (one for UFC and other switches, the other for the lower panels you can see in the pics), and have HUD, AMPCD, LEFT DDI, RIGHT DDI, FORMATION, POSITION and HMD brightness controls mapped. All working perfectly.

f18cthrottle.thumb.jpg.86e02d683e622527b2c130bdc8416830.jpg

  • 1 month later...
Posted

Alright, thanks for the help guys! I got it to work at a different pc with a DCS Steam game. In my own simpit the exact same code on the exact same Arduino Mega board gives no movement at all. Any thoughts on this?? It really drives me crazy

 

#include <Servo.h>

 

/*

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::ServoOutput voltE (0x752e,2, 544, 2400, [](unsigned int newValue) -> unsigned int {

return map(newValue, 0, 43089, 900, 1500);

});

 

DcsBios::ServoOutput voltU (0x752c, 3, 1500, 600, [](unsigned int newValue) -> unsigned int {

return map(newValue, 0, 43089, 600, 1500);

});

 

void setup() {

DcsBios::setup();

}

 

void loop() {

DcsBios::loop();

}

  • Recently Browsing   0 members

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