Cockpit

* User Profile

Welcome, Guest. Please login or register.

Login with username, password and session length

Who's Online

  • *Users: 0
  • *Guests: 48
  • *Total: 48

Our Discord

WORLDFLIGHT 2019 - TEAM USA SUPPORTERS (HERO'S)

 
Worldflight 2019
Donations Starting Early
With 50 Days Left, it's time to start Counting Down to Worldflight 2019.  Beginning in August, we had 2 kind gentleman lead the way on our quest for donations to this amazing Charity Event.  Over the Past 6 Years, we (This community) Has helped to raise over $25,000.00USD to help the kids and their families of the All Children's Hospital in St. Petersburgh, Florida.  Kicking off the donations this year these Two Hero's are leading the way to another Successful Year.  I personally want to thank these two Gentleman and use this opportunity to have all of you donate to our wonderful cause. 
Thank you in advance for your help and please wish us much success for our 2019 event.
       
  ---Worldflight 2019 HEROS---

 James Williams, Warren Soeldner,  Sam Llorca, Doug Snow, Ryan O'Keefe, Edwin Burton, Vincent Thomas, Fred Kurasiewicz, Greg Hembree      





Thanks to all of you, You are all helping to make Worldflight 2019 a success..
Because of all you wonderful people so far we have raised a total of:

$3145.00 USD


Author Topic: Flight Control Panel A Side  (Read 255 times)

Offline kurt-olsson

  • I am chained to this website!
  • *
  • Posts: 1,233
  • 737 -mixed year OEM panel builder.
  • First Name: Peter
  • Home Location: Gothenburg
Flight Control Panel A Side
« on: February 04, 2019, 04:34:38 PM »
This is one side of my Flight Control Panel. I Hate this code, i hate the Commands.
If anyone has a better way of doing this let me know!

const int PIN_KORRY_PUSH_TO_TEST = 16;
const int PIN_KORRY_YAW_DAMPER = 17;
const int PIN_KORRY_AUTO_SLAT_FAIL = 20;
const int PIN_KORRY_FEEL_DIFF_PRESS = 10;
const int PIN_KORRY_MACH_TRIM_FAIL = 9;
const int PIN_KORRY_SPEED_TRIM_FAIL = 6;

const int PIN_SWITCH_YAW_DAMPER = 13;
const int PIN_SWITCH_FLIGHT_CONTROL_A_STBY_RUD = 18;
const int PIN_SWITCH_FLIGHT_CONTROL_A_ON = 19;
const int PIN_SWITCH_FLIGHT_CONTROL_B_STBY_RUD = 14;
const int PIN_SWITCH_FLIGHT_CONTROL_B_ON = 15;

const int PIN_RELAY_YAW_DAMPER = 21;

FlightSimFloat xPlane_readonly_flt_ctr_A_cover_pos;
FlightSimFloat xPlane_readonly_flt_ctr_B_cover_pos;

FlightSimCommand Command_flt_ctr_A_cover;
FlightSimCommand Command_flt_ctr_B_cover;

FlightSimCommand Command_flt_ctr_A_up;
FlightSimCommand Command_flt_ctr_A_dn;

FlightSimFloat xPlane_flt_ctr_A_pos;

FlightSimCommand Command_flt_ctr_B_up;
FlightSimCommand Command_flt_ctr_B_dn;

FlightSimFloat xPlane_flt_ctr_B_pos;


void setup() {
  FlightSim.update();
   
  //Serial.begin(9600);
  pinMode(PIN_KORRY_PUSH_TO_TEST, OUTPUT);
  pinMode(PIN_KORRY_YAW_DAMPER, OUTPUT);
  pinMode(PIN_KORRY_AUTO_SLAT_FAIL, OUTPUT);
  pinMode(PIN_KORRY_FEEL_DIFF_PRESS, OUTPUT);
  pinMode(PIN_KORRY_MACH_TRIM_FAIL, OUTPUT);
  pinMode(PIN_KORRY_SPEED_TRIM_FAIL, OUTPUT);

  pinMode(PIN_SWITCH_YAW_DAMPER,INPUT_PULLUP);
  pinMode(PIN_SWITCH_FLIGHT_CONTROL_A_STBY_RUD,INPUT_PULLUP);
  pinMode(PIN_SWITCH_FLIGHT_CONTROL_A_ON,INPUT_PULLUP);
  pinMode(PIN_SWITCH_FLIGHT_CONTROL_B_ON,INPUT_PULLUP);
  pinMode(PIN_SWITCH_FLIGHT_CONTROL_B_STBY_RUD,INPUT_PULLUP);

  pinMode(PIN_RELAY_YAW_DAMPER,OUTPUT);

  xPlane_readonly_flt_ctr_A_cover_pos = XPlaneRef("laminar/B738/switches/flt_ctr_A_cover_pos");
  xPlane_readonly_flt_ctr_B_cover_pos = XPlaneRef("laminar/B738/switches/flt_ctr_B_cover_pos");

  Command_flt_ctr_A_cover = XPlaneRef("laminar/B738/toggle_switch/flt_ctr_A_cover");
  Command_flt_ctr_B_cover = XPlaneRef("laminar/B738/toggle_switch/flt_ctr_B_cover");

  Command_flt_ctr_A_up = XPlaneRef("laminar/B738/toggle_switch/flt_ctr_A_up");
  Command_flt_ctr_A_dn = XPlaneRef("laminar/B738/toggle_switch/flt_ctr_A_dn");

  xPlane_flt_ctr_A_pos = XPlaneRef("laminar/B738/switches/flt_ctr_A_pos");

  Command_flt_ctr_B_up = XPlaneRef("laminar/B738/toggle_switch/flt_ctr_B_up");
  Command_flt_ctr_B_dn = XPlaneRef("laminar/B738/toggle_switch/flt_ctr_B_dn");

  xPlane_flt_ctr_B_pos = XPlaneRef("laminar/B738/switches/flt_ctr_B_pos");
}

void loop() {
 FlightSim.update(); 
  // put your main code here, to run repeatedly:
 analogWrite(PIN_KORRY_PUSH_TO_TEST,255);
 analogWrite(PIN_KORRY_YAW_DAMPER,255);
 analogWrite(PIN_KORRY_AUTO_SLAT_FAIL,255);
 analogWrite(PIN_KORRY_FEEL_DIFF_PRESS,255);
 analogWrite(PIN_KORRY_MACH_TRIM_FAIL,255);
 analogWrite(PIN_KORRY_SPEED_TRIM_FAIL,255);

 digitalWrite(PIN_RELAY_YAW_DAMPER,HIGH);

 //THIS CODE IS JUST BS, MUST BE A BETTER WAY OF DOING THIS!
 
  if (xPlane_readonly_flt_ctr_A_cover_pos == 0.0f) {
    Command_flt_ctr_A_cover.once();   
  }
  if (xPlane_readonly_flt_ctr_B_cover_pos == 0.0f) {
    Command_flt_ctr_B_cover.once();   
  }

 
  if (xPlane_readonly_flt_ctr_A_cover_pos == 1 && digitalRead(PIN_SWITCH_FLIGHT_CONTROL_A_STBY_RUD) == LOW && xPlane_flt_ctr_A_pos != -1) {
    Command_flt_ctr_A_up.once();
    delay(200);
  }
  if (xPlane_readonly_flt_ctr_A_cover_pos == 1 && digitalRead(PIN_SWITCH_FLIGHT_CONTROL_A_ON) == LOW && xPlane_flt_ctr_A_pos != 1) {
    Command_flt_ctr_A_dn.once();
    delay(200);
  }
  if (digitalRead(PIN_SWITCH_FLIGHT_CONTROL_A_STBY_RUD) == HIGH && digitalRead(PIN_SWITCH_FLIGHT_CONTROL_A_ON) == HIGH) {
    if (xPlane_flt_ctr_A_pos == -1)
      Command_flt_ctr_A_dn.once();
    if (xPlane_flt_ctr_A_pos == 1)
      Command_flt_ctr_A_up.once();
      delay(200);
  }



  if (xPlane_readonly_flt_ctr_B_cover_pos == 1 && digitalRead(PIN_SWITCH_FLIGHT_CONTROL_B_STBY_RUD) == LOW && xPlane_flt_ctr_B_pos != -1) {
    Command_flt_ctr_B_up.once();
    delay(200);
  }
  if (xPlane_readonly_flt_ctr_B_cover_pos == 1 && digitalRead(PIN_SWITCH_FLIGHT_CONTROL_B_ON) == LOW && xPlane_flt_ctr_B_pos != 1) {
    Command_flt_ctr_B_dn.once();
    delay(200);
  }
  if (digitalRead(PIN_SWITCH_FLIGHT_CONTROL_B_STBY_RUD) == HIGH && digitalRead(PIN_SWITCH_FLIGHT_CONTROL_B_ON) == HIGH) {
    if (xPlane_flt_ctr_B_pos == -1)
      Command_flt_ctr_B_dn.once();
    if (xPlane_flt_ctr_B_pos == 1)
      Command_flt_ctr_B_up.once();
      delay(200);
  }

 
 
 //Serial.println(digitalRead(PIN_SWITCH_YAW_DAMPER));
 //Serial.print(digitalRead(PIN_SWITCH_FLIGHT_CONTROL_A_STBY_RUD));
 //Serial.print(digitalRead(PIN_SWITCH_FLIGHT_CONTROL_A_ON));
 //Serial.print(digitalRead(PIN_SWITCH_FLIGHT_CONTROL_B_STBY_RUD));
 //Serial.print(digitalRead(PIN_SWITCH_FLIGHT_CONTROL_B_ON));

 

  delay(20);
 
 
 
}

 

Recent Posts

My New Computer Specs (feedback please)
by tennyson
[Today at 07:15:46 AM]
Mickey's Flightdeck - A Boeing 737-800 Cockpit on Youtube
by mickc
[Today at 05:36:30 AM]
WORLDFLIGHT 2019 - AVAILABILITY
by gjha97
[September 16, 2019, 07:44:23 PM]
WORLDFLIGHT 2019 - FLIGHT BIDS
by gjha97
[September 16, 2019, 07:40:57 PM]
757/767 PROJECT
by helloo
[September 16, 2019, 11:13:43 AM]
Server Upgrade, and SSL Integration
by Trevor Hale
[September 16, 2019, 10:50:39 AM]
727/737 yokes
by Caflyt
[September 15, 2019, 02:11:06 PM]
WORLDFLIGHT 2019 - Scenery Check Volunteers Needed
by Vincent T.
[September 14, 2019, 03:08:00 PM]
WORLDFLIGHT 2019 - Employer matching for Donations...
by RayS
[September 14, 2019, 12:03:45 AM]
SimFest-West 2019 Videos
by RayS
[September 13, 2019, 07:27:16 PM]
737 MAX Build
by helloo
[September 13, 2019, 04:41:17 PM]
A little pucker factor here, I'm sure... nerves of steel
by RayS
[September 12, 2019, 06:30:45 PM]
Which size fuses to use in fuse block supplying FDS boards?
by blueskydriver
[September 11, 2019, 05:56:37 PM]
I finally got the shell pulled off the ATC-810...
by geneb
[September 11, 2019, 07:29:51 AM]
Wanted: Optoma GT1080Darbee Short Throw Projector
by Flightdeck57
[September 11, 2019, 12:24:08 AM]
F16 Simulator For Sale
by blueskydriver
[September 06, 2019, 03:52:34 PM]
Ebay Assistance
by iwik
[September 06, 2019, 02:00:00 PM]
Matrox 3
by jackpilot
[September 05, 2019, 10:45:00 AM]
So I got a big crate the other day...
by geneb
[September 05, 2019, 09:20:22 AM]
Official WF 2019 Route
by fsaviator
[September 05, 2019, 08:20:10 AM]
Are some sellers off their trolly
by kurt-olsson
[September 02, 2019, 12:39:54 PM]
Display Glare FDS w/Pic
by Joe Lavery
[September 01, 2019, 02:33:47 AM]
MCP
by Caflyt
[August 27, 2019, 06:57:41 PM]
Dispatch and Career Add-on
by fsaviator
[August 26, 2019, 10:42:45 AM]
What have you done for your simulator today?
by B763
[August 25, 2019, 04:58:46 PM]
Free Jet Ranger.
by geneb
[August 23, 2019, 06:16:52 PM]
items/oem from overhead
by gufau
[August 23, 2019, 12:49:15 PM]
Hi everyone!
by jskibo
[August 23, 2019, 08:05:33 AM]
737-800 Front window post size
by kurt-olsson
[August 23, 2019, 03:35:11 AM]
Shipping Woes
by Caflyt
[August 22, 2019, 10:47:49 AM]