Results 1 to 3 of 3
  1. #1
    Aviation Enthusiast
    Join Date
    Sep 2013
    Location
    Cornwall, UK
    Posts
    42
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Simple question, please help!

    Hello,

    This is probably really simple so, I apologise in advance!

    I have this code, which is working fine and I am confident that I can easily expand it to all the input switches I need:
    Code:
    int val = 0;int inputPin = 2;
    int valOld = 0;
    int val2 = 0;
    int inputPin2 = 3;
    int valOld2 = 0;
    
    
    void setup()
    {
      pinMode(inputPin, INPUT);
      pinMode(inputPin2, INPUT);
      Serial.begin(115200);
      digitalWrite(inputPin, HIGH);
      digitalWrite(inputPin2, HIGH);
    }
    
    
    void loop() {
      val = digitalRead(inputPin);
    
    
      if (val == valOld) {
      } 
      else {
        if (val == HIGH) { 
          Serial.println("C02");
        } 
        else { 
          Serial.println("C01"); 
        };
        valOld = val;
      }
      val2 = digitalRead(inputPin2);
    
    
      if (val2 == valOld2) {
      } 
      else {
        if (val2 == HIGH) { 
          Serial.println("2 is high");
        } 
        else { 
          Serial.println("2 is low"); 
        };
        valOld2 = val2;
      }
      delay(500);
    }
    My question is how can I extract information (in this same program) and output it to a 4 digit display for COM1 for example?!

    Sam

  2. #2
    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: Simple question, please help!

    I think you'll find everything you need in this thread!

    NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  3. #3
    150+ Forum Groupie
    Join Date
    Nov 2013
    Location
    Evansville, Indiana
    Posts
    243
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Simple question, please help!

    Or do like I did and use a MAX7219 module to drive the display.

    7 segment led displays and my Radio Box
    I will only ever be, half the Geek that I wished I was.
    TheGeekForge.Com