Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: PMDG Events

  1. #1
    10+ Posting Member
    Join Date
    Oct 2013
    Location
    Montreal
    Posts
    20
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    PMDG Events

    Hello !

    I'm trying to send via Link2FS this event, how can I send the increase or decrease info. This will be sent from a button connected to an Arduino using the serial.print like e.g. Serial.println ("A02");

    Thanks,
    Ben

  2. #2
    25+ Posting Member
    Join Date
    Jan 2015
    Location
    Manchester UK
    Posts
    38
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: PMDG Events

    Hi Ben, just use the button to send Serial.println("A02") to increase COM1 or A01 to decrease. Something like:-
    void buttons()
    {
    byte thisSwitch = switchPressed(); // This calls your switch routine
    switch(thisSwitch)
    {
    case 0: // Increase Com1
    Serial.println ("A01");
    break;

    case 1: // Decrease Com1
    Serial.println ("A02");
    break;

    ......etc
    break
    }
    }
    When I read my switches, I put them into an array and compare the array to the last read array. If its changed, then return the switch number

    There is a lot of info in the Link2fs message area, then look up PMDG messages

    paul.h

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

    Re: PMDG Events

    Thanks Paul for the reply,

    Finally, I found this, once we have the offsets (e.g. : 70033) we have to add it under the Experts Simconnect Inputs as : #70033 to an identifier(e.g. : Y17), to increment or decrement this value we have to send Y1710000 or Y1750000

    Serial.println ("Y1750000");

    CaptureL2Koffsets.JPG

  4. #4
    25+ Posting Member
    Join Date
    Jan 2015
    Location
    Manchester UK
    Posts
    38
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: PMDG Events

    Took me a bit to work this out. I was assuming that using "A02" you were talking Com freq changes but looking at your offsets its the MCP controls, such as Heading and Vertical Speed. There is another shortcut, as you will soon run out of simconnect inputs (Y Codes). Just send ZZ70022359 from the arduino code to set your heading to 359. It is explained under "Expert Help" in the section entitled " The "Long" way. Using this route you talk direct from the Arduino code to FSX(PMDG) without using link2fs and hence the slots in link2fs which you may need for other things.
    Hope this helps a little

    Paul.h

  5. #5
    10+ Posting Member
    Join Date
    Oct 2013
    Location
    Montreal
    Posts
    20
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: PMDG Events

    Ho ! this is very nice to know, and what about if I want to increment by one the value instead to force a specific heading ?

  6. #6
    25+ Posting Member
    Join Date
    Jan 2015
    Location
    Manchester UK
    Posts
    38
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: PMDG Events

    On my MCP, I use a rotary encoder. I keep a course variable and increase it or decrease by one, then write the variable out with the ZZ code as my last message. You can read the PMDG heading by using the FSUIPC page in link2fs to read ( for heading ) offset 652C. I then write this to my course variable so its always upto date
    .

  7. #7
    10+ Posting Member
    Join Date
    Oct 2013
    Location
    Montreal
    Posts
    20
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: PMDG Events

    Here is a part of the code I'm using for now, if you can copy/past how you did it with the ZZ feature, that's will be really useful for me.

    Thanks !

    ---------

    n0 = digitalRead(encoder0PinA); // START ROTARY ENCODER 0

    if ((encoder0PinALast == LOW) && (n0 == HIGH))
    {
    if (digitalRead(encoder0PinB) == LOW)
    {
    Serial.println ("Y1850000"); //Increments MCP ALTITUDE - code sent and reconized by simconnect (Experts - SimConnect Inputs #70032)

    }
    else
    {
    Serial.println ("Y1810000"); //Decrements MCP ALTITUDE - code sent and reconized by simconnect (Experts - SimConnect Inputs #70032)
    }
    }

  8. #8
    25+ Posting Member
    Join Date
    Jan 2015
    Location
    Manchester UK
    Posts
    38
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: PMDG Events

    I set read Alt elsewhere in the program to set it to what the MCP says.
    Increment or decrement Alt as required.
    Then add it behind ZZ84137. Offset 84137 allows direct control over the altitude
    Then send it to FSX

    I'll comment and post my bit of code if it will help along with getting Alt from FSX. Anyway, heres the bits added to your code


    String Tempstr"";
    n0 = digitalRead(encoder0PinA); // START ROTARY ENCODER 0

    if ((encoder0PinALast == LOW) && (n0 == HIGH))
    {
    if (digitalRead(encoder0PinB) == LOW)
    {
    Alt += 1000; //Increments MCP ALTITUDE -
    }
    else
    {
    Alt -= 1000; //Decrements MCP ALTITUDE -
    }
    Tempstr = "ZZ84137"+String(Alt);
    String.println (Tempstr);
    }

  9. #9
    10+ Posting Member
    Join Date
    Oct 2013
    Location
    Montreal
    Posts
    20
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: PMDG Events

    Hello Paul,

    Ho wow, This is a good approche. Yes, i'm curious to know how to get this Alt value, probably a serialread of the offset, but not sure how to do this.

  10. #10
    25+ Posting Member
    Join Date
    Jan 2015
    Location
    Manchester UK
    Posts
    38
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: PMDG Events

    Quote Originally Posted by suberben View Post
    Hello Paul,

    Ho wow, This is a good approche. Yes, i'm curious to know how to get this Alt value, probably a serialread of the offset, but not sure how to do this.
    Hi,
    I've extracted a few bits of my code and a few explanatory notes which may help:-

    1. Loop, obviously the main processing loop
    ROTARYS, this checks the six rotary encoders.
    Check19, This is an annunciator test, primarily for testing but may use later
    MCPKEYS, Ckecks the MCP Keys
    EFISLKEYS, Checks the EFIS Keys
    Get a character from Link2fs if available
    2. Hash, a Hash character has been sent from link2fs so get the next character. In the
    case of the altitude its d and c, as can be seen from the link2fs picture. Then
    read the next three characters to read in the low or high byte of altitude and
    display it. The display is not currently enabled but the code is there.
    3. Rotarys, This first checks if its has been turned fast or slow. If fast add or subtract
    1000 feet. If slow, add/subtract 100 feet. Check if alt exceeds 50000 foot and under
    100 foot and reset. Then finally write add Alt to the ZZ code and output to FSX
    Hope this helps
    Attached Images Attached Images
    Attached Files Attached Files

Page 1 of 2 12 LastLast