Jump to content

DCS Bios and servo and stepper... need help...


atkinson
 Share

Recommended Posts

Posted (edited)

Hi friends! I have on hand several instruments, a speed indicator (KUS-1200), an altimeter (VD-10K) and an artificial horizon (AGD-1). I want to implement them, but I ran into a problem, I can't understand the principle of creating a sketch. I also have Arduino Mega, servo motors and stepper motors with drivers. Your professional help is very necessary !!! Understand and grasp the essence. There were no problems with connecting the lamps, I have already assembled several devices, but this is the problem. Specifically, I want to implement a speed indicator for a start, I want to make the device universal for some aircraft, more precisely MiG15.21, L-39 and, if possible, for aircraft from the FC3 module. Budk is very grateful, looked at all the topics, but did not find suitable and clarifying information.


Edited by atkinson
Link to comment
Share on other sites

  • 2 weeks later...

Hi these are the codes I ude for the F-18 Hornet

 

this sould make it easy to understand

 

/* #####################################################
DCS BIOS CODE for OPEN HORNET HYD BRAKE GAUGE
######################################################*/

#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"
#include <Stepper.h>
#define  STEPS  720    // steps per revolution (limited to 315°)
#define  COIL1  8
#define  COIL2  9
#define  COIL3  10
#define  COIL4  11

int HYD_BRK = 0;
int val = 0;

Stepper stepper(STEPS, COIL1, COIL2, COIL3, COIL4);

void onHydIndBrakeChange(unsigned int newValue) {
HYD_BRK = map(newValue, 0, 65000, 0, 1000);
}
DcsBios::IntegerBuffer hydIndBrakeBuffer(0x7506, 0xffff, 0, onHydIndBrakeChange);


void setup(){
  stepper.setSpeed(30);    // set the motor speed to 30 RPM (360 PPS aprox.).
  stepper.step(250);       //Reset Position(250 steps counter-clockwise (just over the Max travel). 
  stepper.step(-17);       //Reset Position(177 steps to the 0 Point clockwise). 
  DcsBios::setup();
}
int pos=0;                 //Position in steps(0-150)

void loop(){
  val = HYD_BRK;   //get the potentiometer value (range 0-1023)
  val = map(HYD_BRK,0,100,0,150);    // map Steper Needle 0-4. 0=0 - 4=150
  if(abs(val - pos)> 2){         //if diference is greater than 2 steps.
      if((val - pos)> 0){
          stepper.step(-1);      // move one step to the left.
          pos++;
          }
      if((val - pos)< 0){
          stepper.step(1);       // move one step to the right.
          pos--;
          }
      }
  DcsBios::loop();

 

//to run 2 x SERVOs, Pin 16 and Pin 18 used, DCS F18 (FP)
#include <Servo.h>
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"



DcsBios::ServoOutput voltU(0x753c,16, 544, 1800); //pin 16
DcsBios::ServoOutput voltE(0x753e,18, 1800, 544); // pin18
void setup() {
  DcsBios::setup();
}

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

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...