Results 1 to 7 of 7
  1. #1
    10+ Posting Member
    Join Date
    Apr 2016
    Location
    Germany, Bavaria, Munich
    Posts
    12
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Arduino Mega: Simple Switch on --> LED light on

    Hello to all!

    I build a universal Cockpit for many types of aircraft. I also use a lot of
    old flightsim's which don't have the possibility to interact with an Arduino.
    The old Jane's series for one example (F-15/F-18/Longbow Anthology etc.).

    So getting feedback from the sim to the Arduino, like many other users do
    in their cockpits because of using simulators like DCS, BMS or FSX,
    makes no sense in my Pit. The old software has simply no interface for it.

    I use Jim's super software "link2fs keys" to send button macros to the simulations
    .
    Many thanks for that, Jim!!!

    Now, just for a little better pseudo "realistic" look, I want a few LED's
    in the pit which simple light if a key is pressed or a switch is in "On"-
    position.

    Could I connect a LED with a resistor in line with the switch, which is connected
    like the wiring for the mega board shows on Jim's link2fs keys?

    5V+ (eg. Pin 10) --> resitor 200 Ohm --> LED --> switch --> ground

    or is the functionality of the switch dissabled in any way, this case?

    Don't want to use extra pins only for the LED's, cause of loosing connections
    for the switches. I have 4 Arduinos in the project and need the 66 switch functions of all of them.

    Thanks in advance,

    Viper

  2. #2
    150+ Forum Groupie


    BushPilotWannabe's Avatar
    Join Date
    Jan 2014
    Location
    Alberta, Canada
    Posts
    176
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Arduino Mega: Simple Switch on --> LED light on

    5V+ --> resitor 200 Ohm --> LED --> switch --> ground. Connect the input between the LED and switch. When open the input may not rise to 4.25V normally specified for digital HIGH but it should be enough. You do not require a pull up for input pin.

    long timeDelay;

    void setup() {
    pinMode(10, INPUT);
    Serial.begin(115200);
    }

    void loop(){
    if (millis() > timeDelay){
    if (digitalRead(10) == LOW) Serial.println("Switch Closed");
    else Serial.println("Switch Open");
    timeDelay = millis() + 500;
    }
    }
    ---CYXD ----- TWR --- GND ------ Closed
    ILS-- NDB -- 119.1 -- 121.9 ---- 11/2013

  3. #3
    10+ Posting Member
    Join Date
    Apr 2016
    Location
    Germany, Bavaria, Munich
    Posts
    12
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Arduino Mega: Simple Switch on --> LED light on

    Double post, sorry!
    Attached Images Attached Images

  4. #4
    10+ Posting Member
    Join Date
    Apr 2016
    Location
    Germany, Bavaria, Munich
    Posts
    12
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Arduino Mega: Simple Switch on --> LED light on

    Thanks for your reply,

    do not really understand what you mean with the input. The input is the switch it self. Have made a little graphic of what I want to do. The modification is in the red circle. The rest is Jim's standard wiring. Just want to use his software as it is. No self programming. The cockpit itself is enough work . Hope Jim has nothing against I've borrowed me his picture, but I think a drawing makes it a bit more clear what I want to do.

    Thanks a lot!


    Attached Images Attached Images

  5. #5
    150+ Forum Groupie


    BushPilotWannabe's Avatar
    Join Date
    Jan 2014
    Location
    Alberta, Canada
    Posts
    176
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Arduino Mega: Simple Switch on --> LED light on

    ref. Link2fs_keys_mega.pde from the http://www.jimspage.co.nz/link2fs_keys_v4.zip package to evaluate the circuit.

    pinMode(doutPin, INPUT); and digitalWrite(doutPin, HIGH); or pinMode(doutPin, INPUT_PULLUP); will only provide enough current through the circuit to make the LED glow when the switch is closed.

    Move the resistor from the MEGA pin #10 to one of the "No Connections 5V" pins (next to pins 22 & 23) and then put a jumper from Arduino pin #10 to the junction between the LED and the switch. Now the LED has enough current to light the LED and pin #10 reads HIGH when the switch is open and LOW when the switch is closed.

    Look at "Properties of Pins Configured as OUTPUT" at https://www.arduino.cc/en/Tutorial/DigitalPins to explain why the LED is dim.

    Hugh
    ---CYXD ----- TWR --- GND ------ Closed
    ILS-- NDB -- 119.1 -- 121.9 ---- 11/2013

  6. #6
    10+ Posting Member
    Join Date
    Apr 2016
    Location
    Germany, Bavaria, Munich
    Posts
    12
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Arduino Mega: Simple Switch on --> LED light on

    Many many thanks!!!!

    No I understood. I'm no electronic technican, but step by step I learn a little more . Have searched for something similar at the Arduino-Page, but there are so many descriptions and none really matched. Now I was nearly about to solve it with an extra circuit and relais. This happens if an ex car mechanic is learning "the force" of electronics .

  7. #7
    10+ Posting Member
    Join Date
    Apr 2016
    Location
    Germany, Bavaria, Munich
    Posts
    12
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Arduino Mega: Simple Switch on --> LED light on

    Double post, sorry!