Results 1 to 4 of 4
  1. #1
    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

    Question An idea, or a blunder to destroy my arduino card

    I have not started flying yet. It took more time than expected to connect everything that is produced during the year.
    I do not know how you guys solve how to connect switches on you're arduino, but I stumbled upon a solution today!
    I tryed this with the "analog in" pins on my arduino, pin connected to ground with a resistor and + 5v through the switch.
    According to eg. "Multi_Keys_Gear_Simconnect" You uses a double action switch with two pins to control eg. the Landinglight, using two pins and this code:

    Code:
      for (int KoutPin = 54; KoutPin < 70; KoutPin++)// Get all the pins ready for simconnect codes and "Keys"(all inputs)  
      {
        pinMode(KoutPin, INPUT);
        digitalWrite(KoutPin, HIGH);  
      }
    etc.etc.etc.etc.
            if (KpinNo == 54 && KpinStateSTR == "0"){Serial.println ("C431");} // Landinglights --- now the switche is ON
            if (KpinNo == 55 && KpinStateSTR == "0"){Serial.println ("C430");} // Landinglights --- now the switche is OFF


    But if you only wont to use one switch/one pin, you can alter the code and only use one switch:

    Code:
      for (int KoutPin = 54; KoutPin < 70; KoutPin++)// Get all the pins ready for simconnect codes and "Keys"(all inputs)    {
        pinMode(KoutPin, INPUT);
        digitalWrite(KoutPin, LOW);  
      }
    etc.etc.etc.etc.
    
            if (KpinNo == 54 && KpinStateSTR == "0"){Serial.println ("C431");} // Landinglights --- now the switche is ON
            if (KpinNo == 54 && KpinStateSTR == "1"){Serial.println ("C430");} // Landinglights --- now the switch is OFF
    Have I invented gunpowder or I'm I standing to close when it slams?
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  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: An idea, or a blunder to destroy my arduino card

    Quote Originally Posted by BuzziBi View Post
    Have I invented gunpowder or I'm I standing to close when it slams?

    Both! In this circumstance, I see no need to use an additional input.

  3. #3
    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: An idea, or a blunder to destroy my arduino card

    Thank you James. Encouraging!
    I have removed my first setup, where I controlled switches through a old keyboard controller (There I found an amazing spaghetti stir. Resistors and capacitors in perfect harmony).
    There was a lot of work with soldering new wires to all the switches, but with a little mind game, I managed to simplify things a bit.
    I was a bit tense to use the analog inputs, since I have not used them before. Considering the 5 volts, I was afraid to ruin the inputs!
    It may be a problem that we amateurs, are served pre-grown codes from You guys. We look at the code, but we do seldom think about how they works.
    That said, I hope you will continue to share codes! One should probably just keep in mind that one should try to understand "what makes things tick"!
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  4. #4
    75+ Posting Member vikingsraven's Avatar
    Join Date
    Dec 2012
    Location
    UK
    Posts
    89
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: An idea, or a blunder to destroy my arduino card

    The arduino is a pretty tough little unit. So as long as you use the boards voltages you can do anything to it. The best option for learning the code is use the examples with the ide (programing program) and just play. Ive not been using the duino long . But ive tried , failed, screamed then click it suddenly makes sense. Youtube has some good videos, and the arduino forum "can" be of great help. (Be prepared for snotty comments though). But youve done the right thing here tried it and then asked. Keep on pluggin away!