Results 1 to 3 of 3
  1. #1
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    May 2015
    Location
    caracas
    Posts
    9
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Question Codigo Arduno Mega 2560 AYUDA

    NOTA: FSX, TARJETA ARDUINO MEGA 2560 Y Link2fs_Multi_FSX_v6f

    Les explico lo que me falta y los pin que he utilizado

    31 (KpinNo == 31){if (KpinStateSTR == "1" ){Serial.println ("C461");}else {Serial.println ("C460");}}//Panel lights
    33 (KpinNo == 33){if (KpinStateSTR == "1" ){Serial.println ("C65030");}else {Serial.println ("C65030");}}//FLAPS 0%
    35 (KpinNo == 35){if (KpinStateSTR == "1" ){Serial.println ("C65000");}else {Serial.println ("C65000");}}//FLAPS 10%
    37 (KpinNo == 37){if (KpinStateSTR == "1" ){Serial.println ("C65075");}else {Serial.println ("C65075");}}//FLAPS 075%
    39 (KpinNo == 39){if (KpinStateSTR == "1" ){Serial.println ("C65100");}else {Serial.println ("C65100");}}//FLAPS 0100%
    41 (KpinNo == 41){if (KpinStateSTR == "1" ){Serial.println ("A431");}else {Serial.println ("A430");}}//AVIONICA MASTER lights
    43 (KpinNo == 43){if (KpinStateSTR == "1" ){Serial.println ("C05");}else {Serial.println ("C06");}}//PITOP HEAT
    45 (KpinNo == 45){if (KpinStateSTR == "1" ){Serial.println ("C451");}else {Serial.println ("C450");}}//Strobe lights
    47 (KpinNo == 47){if (KpinStateSTR == "1" ){Serial.println ("C411");}else {Serial.println ("C410");}}//Nav lights
    49 (KpinNo == 49){if (KpinStateSTR == "1" ){Serial.println ("C441");}else {Serial.println ("C440");}}//Taxi lights
    51 (KpinNo == 51){if (KpinStateSTR == "1" ){Serial.println ("C431");}else {Serial.println ("C430");}}//Landing lights
    53 (KpinNo == 53){if (KpinStateSTR == "1" ){Serial.println ("C421");}else {Serial.println ("C420");}}//Beacon lights

    22 (KpinNo == 22){if (KpinStateSTR == "1" ){Serial.println ("F042");}else {Serial.println ("F042");}}//GASOLINA IZQUIERDO
    24 (KpinNo == 24){if (KpinStateSTR == "1" ){Serial.println ("F043");}else {Serial.println ("F043");}}//GASOLINA DERECHO
    26 (KpinNo == 26){if (KpinStateSTR == "1" ){Serial.println ("F01");}else {Serial.println ("F01");}}//FUELS PUMPS
    28 (KpinNo == 2{if (KpinStateSTR == "1" ){Serial.println ("E16");}else {Serial.println ("E16");}}//MASTER bateria
    30 (KpinNo == 30){if (KpinStateSTR == "1" ){Serial.println ("E25");}else {Serial.println ("E25");}}//MASTER ALTERNADOR
    32 (KpinNo == 32){if (KpinStateSTR == "1" ){Serial.println ("E35");}else {Serial.println ("E35");}}//ENSENDIDO
    FALTA 34 (KpinNo == 34){if (KpinStateSTR == "1" ){Serial.println ("");}else {Serial.println ("");}}//ALT ATATIC AIR
    36 (KpinNo == 36){if (KpinStateSTR == "1" ){Serial.println ("A54");}else {Serial.println ("A540");}}//NAV O GPS
    38 (KpinNo == 3{if (KpinStateSTR == "1" ){Serial.println ("F041");}else {Serial.println ("F041");}}//GASOLINA CENTRO
    FALTA 40 ALT STATIC AIR
    42 (KpinNo == 42){if (KpinStateSTR == "1" ){Serial.println ("C041");}else {Serial.println ("C040");}}// PARKING BRAKE

    FALTA 44 LED NAV
    FALTA 46 LED GPS
    FALTA 48 LED I
    FALTA 50 LED M
    FALTA 52 LED O


    GRACIAS DE ANTEMANO LES AGRADESCO SU AYUDA LE ADJUNTO EL CODIGO PARA SU MEJORA.
    Last edited by GORDOSANCHEZ; 05-28-2015 at 11:51 AM. Reason: ERROR

  2. Dislikes BuzziBi disliked this post
  3. #2
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    May 2015
    Location
    caracas
    Posts
    9
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Codigo Arduno Mega 2560 AYUDA

    ESTE ES EL CODIGO QUE ESTOY UTILIZANDO EN LA ADTUALIDAD

    /*
    This code is in the public domain
    For use with "Link2fs_Multi_beta5d" or later"
    Jimspage.co.nz
    My thanks to the Guys that gave me snippets of code.

    This is just a "demo" of switching the sim's lights on and off.
    Also there is a loop to indicate, via some LED's, if the individual lights are on or off.
    These all use simconnect.(not "keys")
    Some planes are not set up for individual switchings so just fiddle and
    watch the extraction ' On some planes it is even upside-down on some switchs.
    It must have been a Monday morning job at M$ !!!
    The 10 '1's or '0's being sent equate to,,,, (in order, left to right) ,,,
    Nav, Beacon, Landing, Taxi, Strobe, Panel, Recognition, Wing, Logo, Cabin.

    These codes suit the use of TOGGLE switchs as are in the planes for this purpose.

    >>>>>>>> Make sure you have ' "Keys" starts from pin 32 upwards. (Mega)
    */




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


    String KoldpinStateSTR, KpinStateSTR, Kstringnewstate,Kstringoldstate;


    void setup()
    {
    Kstringoldstate = "111111111111111111111111111111111111111111111111111111111111111111111";

    for (int KoutPin = 22; KoutPin < 70; KoutPin++)// Get these pins ready as inputs
    {
    pinMode(KoutPin, INPUT);
    digitalWrite(KoutPin, HIGH);
    }
    for (int KoutPin = 2; KoutPin < 21; KoutPin++)// Get these pins ready as outputs
    {
    pinMode(KoutPin, OUTPUT);
    digitalWrite(KoutPin, LOW);
    }

    Serial.begin(115200);
    }


    void loop() {
    {KEYS();} //Check the "keys" section
    if (Serial.available()) {
    CodeIn = getChar();
    if (CodeIn == '=') {EQUALS();} // The first identifier is "="
    if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
    if (CodeIn == '?') {QUESTION();}// The first identifier is "?"
    if (CodeIn == '/') {SLASH();}// The first identifier is "/" (Annunciators)
    }


    }


    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 'A'://Found the second identifier
    //Do something
    break;

    case 'B':
    //Do something
    break;

    case 'C':
    //Do something
    break;

    //etc etc etc
    }
    }


    void LESSTHAN(){ // The first identifier was "<"
    CodeIn = getChar(); // Get another character
    switch(CodeIn) {// Now lets find what to do with it
    case 'A'://Found the second identifier
    //Do something
    break;

    case 'B':
    //Do something
    break;

    case 'f':
    for (int pinNo = 2; pinNo < 12; pinNo++){//The 10 LED's to indicate lights status
    int lights = getChar();
    if (lights =='1'){digitalWrite(pinNo, HIGH);}else{digitalWrite(pinNo, LOW);}
    }
    break;
    }
    }


    void QUESTION(){ // The first identifier was "?"
    CodeIn = getChar(); // Get another character
    switch(CodeIn) {// Now lets find what to do with it
    case 'A'://Found the second identifier
    //Do something
    break;

    case 'B':
    //Do something
    break;

    case 'C':
    //Do something
    break;

    //etc etc etc
    }
    }
    void SLASH(){ // The first identifier was "/" (Annunciator)
    //Do something
    }
    void KEYS()
    {
    Kstringnewstate = "";
    for (int KpinNo = 22; KpinNo < 70; KpinNo++){
    KpinStateSTR = String(digitalRead(KpinNo));
    KoldpinStateSTR = String(Kstringoldstate.charAt(KpinNo - 22));
    if (KpinStateSTR != KoldpinStateSTR)
    {
    if (KpinNo == 31){if (KpinStateSTR == "1" ){Serial.println ("C461");}else {Serial.println ("C460");}}//Panel lights
    if (KpinNo == 33){if (KpinStateSTR == "1" ){Serial.println ("C65030");}else {Serial.println ("C65030");}}//FLAPS 0%
    if (KpinNo == 35){if (KpinStateSTR == "1" ){Serial.println ("C65000");}else {Serial.println ("C65000");}}//FLAPS 10%
    if (KpinNo == 37){if (KpinStateSTR == "1" ){Serial.println ("C65075");}else {Serial.println ("C65075");}}//FLAPS 075%
    if (KpinNo == 39){if (KpinStateSTR == "1" ){Serial.println ("C65100");}else {Serial.println ("C65100");}}//FLAPS 0100%
    if (KpinNo == 41){if (KpinStateSTR == "1" ){Serial.println ("A431");}else {Serial.println ("A430");}}//AVIONICA MASTER lights
    if (KpinNo == 43){if (KpinStateSTR == "1" ){Serial.println ("C05");}else {Serial.println ("C06");}}//PITOP HEAT
    if (KpinNo == 45){if (KpinStateSTR == "1" ){Serial.println ("C451");}else {Serial.println ("C450");}}//Strobe lights
    if (KpinNo == 47){if (KpinStateSTR == "1" ){Serial.println ("C411");}else {Serial.println ("C410");}}//Nav lights
    if (KpinNo == 49){if (KpinStateSTR == "1" ){Serial.println ("C441");}else {Serial.println ("C440");}}//Taxi lights
    if (KpinNo == 51){if (KpinStateSTR == "1" ){Serial.println ("C431");}else {Serial.println ("C430");}}//Landing lights
    if (KpinNo == 53){if (KpinStateSTR == "1" ){Serial.println ("C421");}else {Serial.println ("C420");}}//Beacon lights
    if (KpinNo == 26){if (KpinStateSTR == "1" ){Serial.println ("F01");}else {Serial.println ("F01");}}//FUELS PUMPS
    if (KpinNo == 2{if (KpinStateSTR == "1" ){Serial.println ("E16");}else {Serial.println ("E16");}}//MASTER bateria
    if (KpinNo == 30){if (KpinStateSTR == "1" ){Serial.println ("E25");}else {Serial.println ("E25");}}//MASTER ALTERNADOR
    if (KpinNo == 32){if (KpinStateSTR == "1" ){Serial.println ("E35");}else {Serial.println ("E35");}}//ENSENDIDO
    if (KpinNo == 34){if (KpinStateSTR == "1" ){Serial.println ("");}else {Serial.println ("");}}//ALT ATATIC AIR
    if (KpinNo == 36){if (KpinStateSTR == "1" ){Serial.println ("A54");}else {Serial.println ("A540");}}//NAV O GPS

    if (KpinNo == 40){if (KpinStateSTR == "1" ){Serial.println ("");}else {Serial.println ("");}}//AOGADOR OFF
    if (KpinNo == 3{if (KpinStateSTR == "1" ){Serial.println ("F041");}else {Serial.println ("F041");}}//GASOLINA CENTRO
    if (KpinNo == 22){if (KpinStateSTR == "1" ){Serial.println ("F042");}else {Serial.println ("F042");}}//GASOLINA IZQUIERDO
    if (KpinNo == 24){if (KpinStateSTR == "1" ){Serial.println ("F043");}else {Serial.println ("F043");}}//GASOLINA DERECHO
    if (KpinNo == 42){if (KpinStateSTR == "1" ){Serial.println ("C041");}else {Serial.println ("C040");}}// PARKING BRAKE



    //now the "keys" bit. Note the pinNo 22 in the line above and the line below.
    if (KpinNo > 22){
    Serial.print ("D");
    if (KpinNo < 10) Serial.print ("0");
    Serial.print (KpinNo);
    Serial.println (KpinStateSTR);
    }
    }
    Kstringnewstate += KpinStateSTR;
    }
    Kstringoldstate = Kstringnewstate;
    }

  4. #3
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    May 2015
    Location
    caracas
    Posts
    9
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Codigo Arduno Mega 2560 AYUDA

    CODIGO ARDUINO PARA COMPLETAR CON LO QUE ME FALTA LES AGRADE SERIA CUALQUIER AYUDA


    https://www.dropbox.com/s/4bkmtew7tl...NAL_1.ino?dl=0