Results 1 to 3 of 3
  1. #1
    25+ Posting Member



    Join Date
    Mar 2009
    Location
    Argentina
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    PROBLEM RESOLVED--FSUIPC problem in expert mode. Again....!!!!

    Hi to all

    I'm trying to move the needle of a real VOR2 gauge.
    I programmed the arduino to read the data from link2fs/FSUIPC in expert mode
    I used the #a in byte mode and see the values being sent to arduino as #axxx.
    but nothing happens.
    If I send the same values from the serial monitor of arduino, this running perfect, but not from the MSFS and link2fs.
    Any suggestions ???
    Thank you very much.

    Jose

  2. #2
    25+ Posting Member



    Join Date
    Mar 2009
    Location
    Argentina
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: FSUIPC problem in expert mode. Again....!!!!

    Some pictures of this problem

    .

    In this pictures, you can see #a VOR#2 Needle offset 0c59 value=188 and tilded. The #a188 is sent to the card.
    The LEDs doesn`t work


    Disconnect the link2fs and test from arduino console. I sent #a188.
    The same code that sent the FS through link2fs and the leds works as display in the next picture





    From MSFS through link2fs #a100 thr needle to the opposite side. the LEDs nothing


    #a100 from the console. the other led was on as display here



    Here the arduino code

    /*
    Codigo Generado para la Cabina de Pablo
    Para usar el programa LINK2FS
    Seccion Potenciometro sacada del ejemplo de Link2FS
    */

    //Zona de definicion de Variables (int) y cadenas de caracteres (string)

    int CodeIn; //define el codigo de caracteres anteriores al numero que viene desde link2fs
    //Indicador de VOR2-------------------------------------------------------------------
    //Parte Aguja del Radial
    int agujavor2_valor;
    String agujavor2,agujavor2old;
    //Fin Parte Aguja del Radial
    //Fin Parte VOR2
    //------------------------------------------------------------------------------------------------------------------
    void setup() {
    // Lo puesto es esta seccion es para todo el codigo y corre solo una vez
    pinMode(10,OUTPUT); //Salida al pin de salida #10 Aguja VOR2
    pinMode(9,OUTPUT); //Salida al pin de salida #9 Aguja VOR2
    Serial.begin(115200); //Velocidad que usaremos en el puerto Serie
    } //fin void setup
    //-----------------------------------------------------------------------------------------------------------------
    void loop() { // Lo puesto es esta seccion es solo para este loop y corre repetitivamente

    if (Serial.available()>0) {
    CodeIn = getChar();
    if (CodeIn == '#') {CARDINAL();} // El primer identificador es "#"
    }
    }

    char getChar() // The serial buffer routine to get a character
    {
    while(Serial.available() == 0); // wait for data
    return((char)Serial.read());
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------------
    void CARDINAL() { //El primer caracter fue '#'
    CodeIn = getChar();//get another charactor from serial port
    if (CodeIn == 'a'){ //Encontro el caracter "k"
    delay (11); // It seems to need a delay here
    agujavor2 = ""; // Vacia la cadena "flappos" para alojar el nuevo valor
    agujavor2 += getChar(); //Read the first data charactor sent
    agujavor2 += getChar(); //Read the second data charactor sent and add it to the first
    agujavor2 += getChar(); //Read the third data charactor sent and add it to the other two.)
    // agujavor2 += char(Serial.read()); //Read the first data charactor sent
    // agujavor2 += char(Serial.read()); //Read the second data charactor sent and add it to the first
    // agujavor2 += char(Serial.read()); //Read the third data charactor sent and add it to the other two.)
    if (agujavor2 != agujavor2old){ //Checks to see if its different to the "old" reading from the last loop
    agujavor2_valor = agujavor2.toInt();
    Serial.print("Afu--");
    Serial.println(agujavor2_valor); //Vamos a leer directamente la entrada del pote sin convertir
    if (agujavor2_valor <= 12{
    agujavor2_valor = map(agujavor2_valor, 0, 128, 0, 255);
    Serial.print("IF--");
    Serial.println(agujavor2_valor); // Escribe valor del OBS del VOR2
    analogWrite(9,agujavor2_valor);
    analogWrite(10,0);
    }
    else
    {
    agujavor2_valor = map(agujavor2_valor, 129, 255, 0, 255);
    Serial.print("ELS--");
    Serial.println(agujavor2_valor); // Escribe valor del OBS del VOR2
    analogWrite(10,agujavor2_valor);
    analogWrite(9,0);
    }
    }
    agujavor2old = agujavor2; // 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
    } // Fin del loop MENOR (Vuelve al VOID loop)
    //----------------------------------------------------------------------------------------------------------------------------------------------------

    Some parts of code are for test and will be removed when it works.
    what am I doing wrong???
    Thanks

    Jose
    Attached Images Attached Images

  3. #3
    25+ Posting Member



    Join Date
    Mar 2009
    Location
    Argentina
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: FSUIPC problem in expert mode. Again....!!!!

    Finally. someone can put some similar arduino code reading from fs and send to card, and that works.
    Oo compare I'm doing wrong.
    Thank you very much

    Jose