Results 1 to 5 of 5
  1. #1
    10+ Posting Member
    Join Date
    Feb 2015
    Location
    Brazi
    Posts
    22
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Rotary switch using an analog input (A0)

    Hi guys,

    I'm facing some issues to configure a 5 position rotary switch with magneto. In my prototype, I'm using a rotary switch connected to an analog input (A0).
    Below is the part of my sketch where I'm reading the value of the analog input (already converted to decimal value between 0 and 4) and send the commands to FSX

    Please, someone could help me to understand what's wrong with this code ?


    switch(selectorValue)
    {
    case 0:Serial.println("E11");
    break;
    case 1:Serial.println("E12");
    break;
    case 2:Serial.println("E13");
    break;
    case 3:Serial.println("E14");
    break;
    case 4:Serial.println("E15");
    break;
    }

  2. #2
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Aug 2014
    Location
    Bangkok
    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: Rotary switch using an analog input (A0)

    Quote Originally Posted by m_mota View Post
    Hi guys,

    I'm facing some issues to configure a 5 position rotary switch with magneto. In my prototype, I'm using a rotary switch connected to an analog input (A0).
    Below is the part of my sketch where I'm reading the value of the analog input (already converted to decimal value between 0 and 4) and send the commands to FSX

    Please, someone could help me to understand what's wrong with this code ?


    switch(selectorValue)
    {
    case 0:Serial.println("E11");
    break;
    case 1:Serial.println("E12");
    break;
    case 2:Serial.println("E13");
    break;
    case 3:Serial.println("E14");
    break;
    case 4:Serial.println("E15");
    break;
    }
    did you have different resistor for 5 position?

  3. #3
    10+ Posting Member
    Join Date
    Feb 2015
    Location
    Brazi
    Posts
    22
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary switch using an analog input (A0)

    Hi Tonpp,

    The problem isn't with the hardware but with the commands in link2fs. I changed the commands to create 2 switches (one for each magneto) and the individual commands doesn't working very well. I already sent another post with more details (http://www.mycockpit.org/forums/showthread.php?t=29412) but have no feedback.

    Tks

    Mauricio

  4. #4
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Aug 2014
    Location
    Bangkok
    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: Rotary switch using an analog input (A0)

    Quote Originally Posted by m_mota View Post
    Hi Tonpp,

    The problem isn't with the hardware but with the commands in link2fs. I changed the commands to create 2 switches (one for each magneto) and the individual commands doesn't working very well. I already sent another post with more details (http://www.mycockpit.org/forums/showthread.php?t=29412) but have no feedback.

    Tks

    Mauricio
    Sorry I don't have any idea with link2fs. I coding and wiring with myself. https://www.youtube.com/watch?v=ijWXgDyRsg0

    Tony

  5. #5
    150+ Forum Groupie


    BushPilotWannabe's Avatar
    Join Date
    Jan 2014
    Location
    Alberta, Canada
    Posts
    176
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary switch using an analog input (A0)

    Your code looks OK. The instructions "E11" through "E15" displayed as expected on Arduino Monitor and Link2FS Monitor. Good choice using an analog rotary switch.

    The FSX default C172 and Beech B58 appear to want a switch increment/decrement command similar to flaps up/down. Hover over the switch and "+", "-" are displayed. Starting and stopping the engine is no problem. Going to left mag and right mag on engine run up appears to be the problem. Recognition of the command is hit or miss.

    Other aircraft may use the more precise OFF, LEFT, RIGHT instructions.

    FSUIPC instructions probably exist, if a pipeline for them is allowed through the published aircraft model? If so, I would like to push a button on the flight yoke, decode the "all ordnance away" extraction to enable a block of alternate rotary encoder commands. Thus saving a digital pin, and employing unused yoke buttons, while not having to rewire the flight yoke. Does anybody have a FSUIPC primer? Not the rewritten "Help" files. "For Idiots:" likely part of the title.
    Last edited by BushPilotWannabe; 05-14-2015 at 09:46 PM. Reason: Foot In Mouth Again
    ---CYXD ----- TWR --- GND ------ Closed
    ILS-- NDB -- 119.1 -- 121.9 ---- 11/2013