Results 1 to 4 of 4

Thread: Ian

  1. #1
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Sep 2013
    Location
    Christchurch
    Posts
    6
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Ian

    Hi all
    Have posted before but am stuck
    Trying to get a few switches to work using the Mega card which I have just purchased
    Am using Jims Link2FS program and FSX
    Where do i get the code for the switches?
    Thanks
    Ian

  2. #2
    75+ Posting Member



    Join Date
    Sep 2013
    Location
    California, USA
    Posts
    109
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Ian

    Hi Ian,
    Many ways to do this, here is one example:
    Wire your switch from ground to the arduino pin. (ex: pin 40).
    Let's assume your switch function is "Turn pitot heat switch on".

    boolean pitotHeatSwitch; //use your own switch name here
    boolean oldPitotSwitch;

    void setup() {
    Serial.begin(9600); // use 9600 for the serial monitor, 115200 for L2fsx
    pinMode (40, INPUT_PULLUP); // defines pin 40 as an input, using the pullup resistor
    oldPitotSwitch = 0; // sets initial state of oldPitotSwitch to 0
    }
    void loop(){
    pitotHeatSwitch = !digitalRead(40); //reads switch state, stores result
    //the next lines test to see if the switch position has changed, and if it has,
    //it will send data to L2fsx
    if ( (pitotHeatSwitch == 1) &&(oldPitotSwitch != pitotHeatSwitch)) Serial.println("C05"); //C05 turns on the pitot heat
    if ( (pitotHeatSwitch == 0) &&(oldPitotSwitch != pitotHeatSwitch)) Serial.println("C06"); //C06 turns off the pitot heat
    delay(50); // this is to slow down the printing interval
    oldPitotSwitch = pitotHeatSwitch; //resets oldPitotSwitch to match current condition
    }

  3. #3
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Sep 2013
    Location
    Christchurch
    Posts
    6
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Ian

    Thanks for the reply.
    I will have a play with this and let you no how I get on.
    I am new to Arduino coding. Can do all the wiring stuff OK but the coding is all new.
    I seam to recall that Jim had a full code download that went with his Link2fsMulti. do you no were I can get this?
    Thanks again
    Ian

  4. #4
    75+ Posting Member



    Join Date
    Sep 2013
    Location
    California, USA
    Posts
    109
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site