atkinson Posted May 22, 2021 Share Posted May 22, 2021 (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 May 22, 2021 by atkinson Link to comment Share on other sites More sharing options...
Ben-111 Posted June 3, 2021 Share Posted June 3, 2021 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 More sharing options...
fusion Posted January 7, 2022 Share Posted January 7, 2022 On 6/3/2021 at 4:50 PM, Ben-111 said: 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(); } Is there any possibility you can help with the F-16 RPM gauge? I've tried everything. Using the X27.168 stepper motor. Direct connect to arduino doesn't seem to have issues. It's just the issue of trying to find out what values is being provided so we can make adjustments from there. Link to comment Share on other sites More sharing options...
Recommended Posts