Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Nov 2013
    Location
    Antwerp, Belgium
    Posts
    7
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Marker indicator

    Recently I have made the plunge and I started my own cockpit.
    (The goal is to make C172 a cockpit)


    After a lot of research I saw the possibilities of Arduino and Jim's fantastic job with Link2fs and decided to go on this path to make my own cockpit.
    After a week of 'playing' with the arduino card, and thanks to the examples to be found, I managed to simulate an Annuciator with the indications i wanted. I also figured out how to use the rotary encoder with push button, again thanks to the examples found in the Forum and in Jim's Packages.


    - Now the big question

    I thought it would be easy to make 3 marker indicators but..
    Unfortunately I can not find the link2fs_multi ability to retrieve the simconnect extractions for the marker information from FSX

    (I have already been successful, thanks to zulucat and his post of 10/23/12 to do work through link2fs_inOut_v but I can not work with link2fs_multi markers)

    Do i oversee something or is it not (yet) possible in link2fs_multi?




    Thx
    Johan

  2. #2
    150+ Forum Groupie
    Join Date
    Apr 2011
    Location
    United States of America
    Posts
    232
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Marker indicator

    Hello Johan and welcome to the world of Arduino.

    Link2FS Multi identifier:
    "=V"

    Marker beacon state:
    0 = None
    1 = Outer
    2 = Middle
    3 = Inner

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

    Re: Marker indicator

    Thans for the info!
    I'll post the sketch when i am succesfull.

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

    Re: Marker indicator

    Edit: deletend due to double post

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

    Re: Marker indicator

    Unfortunatly, i am unsuccesfull..
    I thought if i would follow the logic of the flaps led indicator, but it doesn't seem to work.
    I have tried several different things, without any succes..

    The code below, is what i believed was the correct approach.

    Can someone assist in what i am doing wrong ?
    Am I working in the wrongdirection ?

    thx for the advice,
    Johan



    int CodeIn;// used on all serial reads
    int KpinNo;
    int Koutpin;
    String marker;


    String KoldpinStateSTR, KpinStateSTR, Kstringnewstate,Kstringoldstate;


    void setup()
    {
    Kstringoldstate = "111111111111111111111111111111111111111111111111111111111111111111111";

    for (int KoutPin = 8; KoutPin < 20; KoutPin++)// Set's up all the input pins
    {
    pinMode(KoutPin, INPUT);
    digitalWrite(KoutPin, HIGH);
    }
    pinMode(2, OUTPUT); // Outer marker
    pinMode(3, OUTPUT); // Middel marker
    pinMode(4, OUTPUT); // Inner marker
    Serial.begin(115200);
    }


    void loop() {
    {KEYS();} //Check the "keys" section
    if (Serial.available()) {
    CodeIn = getChar();//get a character
    if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
    }//end of serial check
    }//end of void loop


    char getChar()// Get a character from the serial buffer
    {
    while(Serial.available() == 0);// wait for data
    return((char)Serial.read());// Thanks Doug
    }


    void LESSTHAN(){ // The first identifier was "<"
    CodeIn = getChar(); // Get another character
    switch(CodeIn) {// Now lets find what to do with it
    case '=V'://Found the second identifier ("=V" Marker position)
    marker = "";
    marker += getChar();
    marker += getChar();
    marker += getChar();
    int markerInt = marker.toInt(); // convert it to an integer (Thanks Phill)
    if (markerInt = 1) {digitalWrite(2, HIGH);} else {digitalWrite(2, LOW);}
    if (markerInt = 2) {digitalWrite(3, HIGH);} else {digitalWrite(3, LOW);}
    if (markerInt = 3) {digitalWrite(4, HIGH);} else {digitalWrite(4, LOW);}
    break;
    }
    }


    void KEYS()
    {
    Kstringnewstate = "";
    for (int KpinNo = 8; KpinNo < 20; KpinNo++){//check for inputs on pins 8 to 20
    KpinStateSTR = String(digitalRead(KpinNo)); //if you change the 8 in the line above ,, also change the 8 in the line below
    KoldpinStateSTR = String(Kstringoldstate.charAt(KpinNo - );
    if (KpinStateSTR != KoldpinStateSTR)//yes it's different
    {
    if (KpinNo != 13){ //pin 13 is no good as an input, it can "flutter" unless set up correctly
    if (KpinNo == 8 && KpinStateSTR == "0"){Serial.println ("A53");} //flap handle up a bit
    if (KpinNo > 9){//now the keys bit
    Serial.print ("D");
    if (KpinNo < 10) Serial.print ("0");
    Serial.print (KpinNo);
    Serial.println (KpinStateSTR);
    }//end of keys bit
    }//end of its not pin 13
    }//end of yes its different
    Kstringnewstate += KpinStateSTR;
    }//end of 'For' loop
    Kstringoldstate = Kstringnewstate;
    }// end of "inputs" void

  6. #6
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    275
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Marker indicator

    I think I see your error!
    The code for You're "case '=V' " , must be in the "viod equals", not in the void "lessthan" , because the NAV/COM Radios Marker identifier is "=V0"("equals"V0) and so on.

    Then I noticed that You did not "int" You're LEDs!
    I do only fly VFR myself, so I do not know how to use the Marker, and therefor kan not test!
    (all time going in making the cockpit, no time for learning to fly
    )
    Here's a suggestion:
    At the top of you're sketch:
    Code:
    int ledOuter = 2;
    int ledMiddle = 3;
    int ledInner = 4;
    
    void setup(){ 
    pinMode(ledOuter, OUTPUT); // Outer marker
    pinMode(ledMiddle, OUTPUT); // Middel marker
    pinMode(ledInner, OUTPUT); // Inner marker
    //and Youre other stuff
    }
    void loop(){
    // and all you're stuff
    void EQUALS(){      // The first identifier was "="
     CodeIn = getChar(); // Get another character
      switch(CodeIn) {// Now lets find what to do with it
    case '=V'://Found the second identifier ("=V" Marker position)
    marker = "";
    marker += getChar();
    marker += getChar();
    marker += getChar();
    int markerInt = marker.toInt(); // convert it to an integer (Thanks Phill)
    if (markerInt = 01) {digitalWrite(ledOuter, HIGH);} else {digitalWrite(ledOuter, LOW);}
    if (markerInt = 02) {digitalWrite(ledMiddle, HIGH);} else {digitalWrite(ledMiddle, LOW);}
    if (markerInt = 03) {digitalWrite(ledInner, HIGH);} else {digitalWrite(ledInner, LOW);}
    break;
    For me, this way it is easyer to identefy things in the sketch. Avoiding all the digits!
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

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

    Re: Marker indicator

    Thanks,
    i see my mistake - I used your information and code to produce the following sketch;
    But still, no marker indication.
    IN markerInt, i tried both 01 as 1 (etc) but it haddend any impact.


    The markers are a nice addon to my Arduino Uno C172 panel, and thought it would be easy - but i find them the hardest to crack yet.


    int CodeIn;// used on all serial reads
    int ledOuter = 2;
    int ledMiddle = 3;
    int ledInner = 4;
    String marker;




    void setup()
    {
    Serial.begin(115200);
    }


    void loop() {
    if (Serial.available()) {
    CodeIn = getChar();//get a character
    if (CodeIn == '=') {EQUALS();}// The first identifier is "="
    }//end of serial check
    }//end of void loop


    char getChar()// Get a character from the serial buffer
    {
    while(Serial.available() == 0);// wait for data
    return((char)Serial.read());// Thanks Doug
    }


    void EQUALS(){ // The first identifier was "="
    CodeIn = getChar(); // Get another character
    switch(CodeIn) {// Now lets find what to do with it
    case '=V'://Found the second identifier ("V" Marker position)
    marker = "";
    marker += getChar();
    marker += getChar();
    marker += getChar();
    int markerInt = marker.toInt(); // convert it to an integer (Thanks Phill)
    if (markerInt = 01) {digitalWrite(ledOuter, HIGH);} else {digitalWrite(ledOuter, LOW);}
    if (markerInt = 02) {digitalWrite(ledMiddle, HIGH);} else {digitalWrite(ledMiddle, LOW);}
    if (markerInt = 03) {digitalWrite(ledInner, HIGH);} else {digitalWrite(ledInner, LOW);}
    break;
    }
    }

  8. #8
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    275
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Marker indicator

    I searched a bit on google, to see if I could manage to find out how to receive Marker of FSX, but did not read enough to find out.
    If I flew over a airport and landed (while MKR button on the radio panel is green), but did only receive "=V0" , on Link2fs monitor.
    Marker.jpg
    I do not know if this is enough or how to get the Marker indicators to change.
    If You make an approch, while loocing on the Link2fs monitor, do the value change from =V0 to =V1 and so on, in the Link2fs monitor?
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

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

    Re: Marker indicator

    I saw the value next to =V change into 1 and 2 while flying over the markers of EBAW.
    therefore, i changed iT from 01 - 02 - 03 to 1 - 2 - 3 but with no succes....

    the MRK button is only to activate the sound, which is no issue to program in link2fs, i got it working quite easy.

  10. #10
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    275
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Marker indicator

    This code seems works. I canged the Outermarker to light the led while receiving =V0.
    You had an error in you're code.
    Code:
        case '=V'://Found the second identifier
    it most be
    Code:
        case 'V'://Found the second identifier
    my test code
    Code:
    int CodeIn;// The normal declearations go here
    
    
    int ledOuter = 2;
    int ledMiddle = 3;
    int ledInner = 4;
    
    
    String marker;
    int markeri;
    
    
    void setup(){
      
    pinMode(ledOuter, OUTPUT); // Outer marker
    pinMode(ledMiddle, OUTPUT); // Middel marker
    pinMode(ledInner, OUTPUT); // Inner marker
       Serial.begin(115200); 
           // The normal startup stuff goes here
    }
    
    
    void loop() {
      {OTHER();}// Check for "Other" things to do. (Non extraction stuff)
      if (Serial.available()) {  //Check if anything there
        CodeIn = getChar();      //Get a serial read if there is.
        if (CodeIn == '=') {EQUALS();} // The first identifier is "=" ,, goto void EQUALS
        if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<" ,, goto void LESSTHAN
        if (CodeIn == '?') {QUESTION();}// The first identifier is "?" ,, goto void QUESTION
        if (CodeIn == '/') {SLASH();}// The first identifier is "/"  ,, goto void SLASH (Annunciators)
      }
    }
    
    
    char getChar()// Get a character from the serial buffer(Dont touch)
    {
      while(Serial.available() == 0);// wait for data (Dont touch)
      return((char)Serial.read());// (Dont touch) Thanks Doug
    }
    
    
    void OTHER(){
    
    
    }
    
    
    void EQUALS(){      // The first identifier was "="
           CodeIn = getChar(); // Get another character
      switch(CodeIn) {// Now lets find what to do with it
        case 'V'://Found the second identifier
    marker = "";
    marker += getChar();
    marker += getChar();
    int markeri = marker.toInt(); // convert it to an integer (Thanks Phill)
    
    
    if (markeri == 00) {digitalWrite(ledOuter, HIGH);} else {digitalWrite(ledOuter, LOW);}
    if (markeri == 02) {digitalWrite(ledMiddle, HIGH);} else {digitalWrite(ledMiddle, LOW);}
    if (markeri == 03) {digitalWrite(ledInner, HIGH);} else {digitalWrite(ledInner, LOW);}
    
    
     break;
         }
    }
    Change the if (markeri == 00) toif (markeri == 01) and go for a ride.
    Also You forgot to int the "markeri". Let me know if it works
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

Page 1 of 2 12 LastLast