Results 1 to 8 of 8
  1. #1
    Our new friend needs to reach 10 posts to get to the next flight level mac1963's Avatar
    Join Date
    Apr 2012
    Location
    Oz
    Posts
    5
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Uno R3 and Link2FS regarding IOM Markers using LED's

    Hi all, I just received my Uno card in the mail today and have it installed etc. My question if anyone can help is (excuse my lack of knowledge) I require some kick start on how to get the IOM markers going in FSX. I have read and read over the pass few weeks but the penny hasn't dropped yet.

  2. #2
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    764
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Uno R3 and Link2FS regarding IOM Markers using LED's

    Hi Mac ,, I'm surprised no-one else has answered this but I suppose it's given you time to have a dig thru more of the samples etc.

    What you want to do is actually quite simple and a modification of one the PDE's in my "starter pack" is all you need to do.
    Have a look at the "starter" No.2 PDE and work out what goes on and also notice the amount of data my program sends and adjust the PDE to suit.

    The starter pack is here ,,,
    www.jimspage.co.nz/starterpde.htm

    Have fun with it Mac ,, when the penny drops ,, it's a lot of fun.

    Jim
    Last edited by Jim NZ; 10-21-2012 at 04:54 AM.
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  3. #3
    Our new friend needs to reach 10 posts to get to the next flight level mac1963's Avatar
    Join Date
    Apr 2012
    Location
    Oz
    Posts
    5
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Uno R3 and Link2FS regarding IOM Markers using LED's

    Hi Jim, Thanks for your reply, I do appreciate it. I have been messing around with the card today and wrote a test PDE to control LED's (various flash rates etc) and have that sorted, well in test only. After reading your website and starter PDE's I get the gist of how it should work, I just don't see where I will get the individual Marker info from to assign my LED's. For example my Inner marker will be, int led = 14; Middle Marker, int led = 15; and Outer Marker, int led = 16; but the rest of the code escapes me. I'm sure it is all very easy but with my old brain nothing comes easy lol
    Just to say you do have a wealth of information posted on your site and I thank you for that!
    Cheers,
    Brian

  4. #4
    Our new friend needs to reach 10 posts to get to the next flight level mac1963's Avatar
    Join Date
    Apr 2012
    Location
    Oz
    Posts
    5
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Uno R3 and Link2FS regarding IOM Markers using LED's

    With the help of Jims Starter 1 PDE, Thanks Jim! I've had a go at a IOM and stall warning LED PDE.. if anyone can see any problems in it could they leave a reply so I can amend / scrap it..

    Thanks,
    Brian




    void setup() {
    // initialize the digital pin as an output.
    // Pin 14 has an LED connected on most Arduino boards:
    pinMode(14, OUTPUT); // Intitalises the pin 14 as an output pin.
    Serial.begin(115200); // sets up the baud rate for the serial coms.
    }
    void loop() {
    if (Serial.available() > 0) { //if there is a charactor in the serial receive buffer then ,,,,
    xx = Serial.read(); // read it.
    if (xx == 'L'){ // Found the reading "Stall Warning"
    delay (11); // It seems to need a delay here
    stallwarning = ""; // Empty stallwarning string
    stallwarning += char(Serial.read()); //Read the charactor sent

    if (stallwarning != stallwarningold){ // checks to see if its different to the "old" reading from the last loop
    if (stallwarning == "000") { //if its "000" then turn OFF the LED
    digitalWrite(14, LOW);
    }
    if (stallwarning > "000" && stallwaring < "100"){ // if its greater than "000" and less than "100" then ,,,
    digitalWrite(14, HIGH); // set the LED on
    delay(50); // wait for 50 milliseconds
    digitalWrite(14, LOW); // set the LED off
    delay(50); // wait for 50 milliseconds
    }
    if (stallwarning == "100") {
    digitalWrite(14, HIGH);
    } //if its "100" percent down then turn ON the LED

    stallwarning = stallwarning; // Makes the old reading the same as the new reading.(So on the next reading it can check to see if it's different)
    } // end of the "yes it's different to the old reading" sequence
    } //end of "found the stallwarning" (L) read
    } // end of "Yes" there is a serial read.
    } // end of main loop (It goes back to the start of the main loop)

    void setup() {
    // initialize the digital pin as an output.
    // Pin 15 has an LED connected on most Arduino boards:
    pinMode(15, OUTPUT); // Intitalises the pin 15 as an output pin.
    Serial.begin(115200); // sets up the baud rate for the serial coms.
    }
    void loop() {
    if (Serial.available() > 0) { //if there is a charactor in the serial receive buffer then ,,,,
    xx = Serial.read(); // read it.
    if (xx == '>O'){ // Found the reading "Inner Marker"
    delay (11); // It seems to need a delay here
    innermarker = ""; // Empty innermarker string
    innermarker += char(Serial.read()); //Read the charactor sent

    if (innermarker != innermarkerold){ // checks to see if its different to the "old" reading from the last loop
    if (innermarker == "000") { //if its "000" then turn OFF the LED
    digitalWrite(15, LOW);
    }
    if (innermarker > "000" && innermarker < "100"){ // if its greater than "000" and less than "100" then ,,,
    digitalWrite(15, HIGH); // set the LED on
    delay(50); // wait for 50 milliseconds
    digitalWrite(15, LOW); // set the LED off
    delay(50); // wait for 50 milliseconds
    }
    if (innermarker == "100") {
    digitalWrite(15, HIGH);
    } //if its "100" percent down then turn ON the LED

    innermaker = innermarker; // Makes the old reading the same as the new reading.(So on the next reading it can check to see if it's different)
    } // end of the "yes it's different to the old reading" sequence
    } //end of "found the innermaker" (>O) read
    } // end of "Yes" there is a serial read.
    } // end of main loop (It goes back to the start of the main loop)

    void setup() {
    // initialize the digital pin as an output.
    // Pin 16 has an LED connected on most Arduino boards:
    pinMode(16, OUTPUT); // Intitalises the pin 16 as an output pin.
    Serial.begin(115200); // sets up the baud rate for the serial coms.
    }
    void loop() {
    if (Serial.available() > 0) { //if there is a charactor in the serial receive buffer then ,,,,
    xx = Serial.read(); // read it.
    if (xx == '>P'){ // Found the reading "Middle Marker"
    delay (11); // It seems to need a delay here
    middlemarker = ""; // Empty middlemarker string
    middlemarker += char(Serial.read()); //Read the charactor sent
    if (middlemarker != middlemarkerold){ // checks to see if its different to the "old" reading from the last loop
    if (middlemarker == "000") { //if its "000" then turn OFF the LED
    digitalWrite(16, LOW);
    }
    if (middlemarker > "000" && middlemarker < "100"){ // if its greater than "000" and less than "100" then ,,,
    digitalWrite(16, HIGH); // set the LED on
    delay(50); // wait for 50 milliseconds
    digitalWrite(16, LOW); // set the LED off
    delay(50); // wait for 50 milliseconds
    }
    if (middlemarker == "100") {
    digitalWrite(16, HIGH);
    } //if its "100" percent down then turn ON the LED

    middlemarker = middlemarker; // Makes the old reading the same as the new reading.(So on the next reading it can check to see if it's different)
    } // end of the "yes it's different to the old reading" sequence
    } //end of "found the middlemarker" (>P) read
    } // end of "Yes" there is a serial read.
    } // end of main loop (It goes back to the start of the main loop)

    void setup() {
    // initialize the digital pin as an output.
    // Pin 17 has an LED connected on most Arduino boards:
    pinMode(17, OUTPUT); // Intitalises the pin 17 as an output pin.
    Serial.begin(115200); // sets up the baud rate for the serial coms.
    }
    void loop() {
    if (Serial.available() > 0) { //if there is a charactor in the serial receive buffer then ,,,,
    xx = Serial.read(); // read it.
    if (xx == '>Q'){ // Found the reading "Outer Marker"
    delay (11); // It seems to need a delay here
    outermarker = ""; // Empty outermarker string
    outermarker += char(Serial.read()); //Read the charactor sent
    if (outermarker != outermarkerold){ // checks to see if its different to the "old" reading from the last loop
    if (outermarker == "000") { //if its "000" then turn OFF the LED
    digitalWrite(17, LOW);
    }
    if (outermarker > "000" && outermarker < "100"){ // if its greater than "000" and less than "100" then ,,,
    digitalWrite(17, HIGH); // set the LED on
    delay(50); // wait for 50 milliseconds
    digitalWrite(17, LOW); // set the LED off
    delay(50); // wait for 50 milliseconds
    }
    if (outermarker == "100") {
    digitalWrite(17, HIGH);
    } //if its "100" percent down then turn ON the LED

    outermarker = outermarker; // Makes the old reading the same as the new reading.(So on the next reading it can check to see if it's different)
    } // end of the "yes it's different to the old reading" sequence
    } //end of "found the outermarker" (>Q) read
    } // end of "Yes" there is a serial read.
    } // end of main loop (It goes back to the start of the main loop)

  5. #5
    25+ Posting Member zulucat's Avatar
    Join Date
    Sep 2012
    Location
    Southern SoCal
    Posts
    36
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Uno R3 and Link2FS regarding IOM Markers using LED's

    I looked at your examples and found a few problems.

    * The UNO led is on pin 13 not pin 14. You'll notice in the code that I've used a "#define" statement. This lets you give a meaningful name to a constant. Plus, if you change pin numbers you'll only need to change one statement.

    * You should check Serial.available() for every character you read not just the first one. I've created a simple function to do that.

    * Stall Warning is a single character (not 3). I assume that it is either a "1" or a "0".

    Here's an (untested) example that should work

    // --- Stall Warning ---

    #define LED1 13


    void setup()
    {
    pinMode(LED1, OUTPUT); // Intitalises the pin 14 as an output pin.
    Serial.begin(115200); // sets up the baud rate for the serial coms.
    }


    void loop()
    {
    char ch;

    ch = getChar();
    if (ch == 'L') { // Found the reading "Stall Warning"
    ch = getChar();
    if (ch == '0')
    digitalWrite(LED1, LOW);
    else
    digitalWrite(LED1, HIGH);
    }
    }


    char getChar()
    {
    while (Serial.available() == 0); // wait for data
    return(Serial.read());
    }

  6. #6
    Our new friend needs to reach 10 posts to get to the next flight level mac1963's Avatar
    Join Date
    Apr 2012
    Location
    Oz
    Posts
    5
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Uno R3 and Link2FS regarding IOM Markers using LED's

    Thanks zulucat for your help, I will study your example and try to get to terms with it all. How did the Mkrs code look to you, am I far off the mark?

    Anyway a big thanks,

    Brian

  7. #7
    25+ Posting Member zulucat's Avatar
    Join Date
    Sep 2012
    Location
    Southern SoCal
    Posts
    36
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Uno R3 and Link2FS regarding IOM Markers using LED's

    Quote Originally Posted by mac1963 View Post
    Thanks zulucat for your help, I will study your example and try to get to terms with it all. How did the Mkrs code look to you, am I far off the mark?
    Brian,

    Your marker examples have the same sort problems that the Stall Warning example has. From your comments above I get the feeling that you are not familiar with the C programming language -- that's the language UNO sketches are written in.

    If you plan to work with the UNO very much you should probable learn the rudiments of C. The Arduino web site has a section called "Learning" which may prove useful to you. The site also has a section called "Reference" that details the many functions provided by the IDE software; pinMode() and digitalWrite() are examples.
    Arduino Web Site: Arduino - HomePage

    Lastly, a good book on C programming would be very helpful. I can recommend Programming in C by Stephen Kochan.

    I've attached an UNO sketch that uses pins 2, 3 & 4 to display marker information. I've made the assumption that Link2FS sends a single character to indicate the state of a marker.

    Good luck with your project - Doug
    Attached Files Attached Files

  8. #8
    25+ Posting Member zulucat's Avatar
    Join Date
    Sep 2012
    Location
    Southern SoCal
    Posts
    36
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Uno R3 and Link2FS regarding IOM Markers using LED's

    EDIT: Remove text from duplicate post.