Page 1 of 4 1234 LastLast
Results 1 to 10 of 34
  1. #1
    25+ Posting Member
    Join Date
    Apr 2012
    Location
    New Zealand
    Posts
    35
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Wanted URGENT!!! Example 3 digit 7 segment led FSX Link2fs Sketch!!!

    My friend and i r urgently looking for an example to work off to make our airspeed 3 digit 7 segment led display to work, thnx in advance!

    P.S IM useing common anode leds!

  2. #2
    150+ Forum Groupie
    Join Date
    Oct 2010
    Location
    Australia
    Posts
    166
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wanted URGENT!!! Example 3 digit 7 segment led FSX Link2fs Sketch!!!

    Hi,

    You could start here http://www.flightsimparts.eu/Simulat..._7Segment.html I am using these in my homemade MCP with Prosim737.

    Kind Regards

    Bernie
    E8400 @ 3.0GHz, DDR2 Ram 800MHz 4Gb, Vista Home Premium 64Bit, MSI 9800GT @ 512Mb, Philips 22" LCD Widescreen, Cockpit Setup X 5 using Wideview and Widetraffic.

  3. #3
    25+ Posting Member
    Join Date
    Apr 2012
    Location
    New Zealand
    Posts
    35
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wanted URGENT!!! Example 3 digit 7 segment led FSX Link2fs Sketch!!!

    Hmm thnx bruv that is a nice alternative to arduino but i really just want a example sketch for the arduino useing 7 segment common anode thru link 2fs as that is my current setup, im sure once i see an example of how the airspeed is written to the segments i will be away and flying to do them all,. Anyways still looking for an example sketch if anyone has one i could borrow!!!

  4. #4
    150+ Forum Groupie
    Join Date
    Apr 2010
    Location
    Auburn, WA
    Posts
    204
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wanted URGENT!!! Example 3 digit 7 segment led FSX Link2fs Sketch!!!

    Unless you're absolutely stuck using those common anode displays, I'd suggest you source some similar common cathode displays and use a Max7219 to drive them. They're available cheap from Tayda Electronics

    http://www.taydaelectronics.com/cata...ult/?q=max7219

    and there's an easy-to-use library available at the Arduino playground.

    http://arduino.cc/playground/Main/LedControl

    I've had good luck getting displays from Arrow Electronics. They've got a great selection at reasonable prices.

    http://components.arrow.com/part/sea...whereFrom=gnav

  5. Thanks MadMaori thanked for this post
  6. #5
    25+ Posting Member
    Join Date
    Jun 2012
    Location
    Canada
    Posts
    34
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wanted URGENT!!! Example 3 digit 7 segment led FSX Link2fs Sketch!!!

    What are you using to drive them? You are going to use up a lot of pins if you don't have some form of IC as well.

    Assuming a single 7 segment digit with decimal point you will use up 9 pins. (one for each segment plus decimal point and one common). To add more digits, simply connect each segment to the last digit and add a 10th "annode" pin to the second digit and continue expanding. but a simple 3 digit heading indicator will use up 11 pins... For this method, simply enable (digitalwrite) the pins for the digit you want to display then enable the annode pin for the segment display you want for say 5 milliseconds. disable the annode pin, repeat for each segment display and then at the end, start your loop over again. by roatating through each character, your eye will think that they are all on at the same time as it will happen so fast.

    You can get around this by using a Max7219 as was suggested, or I used a 74HC595 shift register for each digit. The code for this method is completely different.

    Here is a basic idea of what I am doing....
    Code:
      // take the latchPin low so the LEDs don't change while you're sending in bits:
      digitalWrite(latchPin, LOW);
    
      if (digit == 0)
        shiftOut(dataPin, clockPin, MSBFIRST, B10000001);
      if (digit == 1)
        shiftOut(dataPin, clockPin, MSBFIRST, B11110011);
      if (digit == 2)
        shiftOut(dataPin, clockPin, MSBFIRST, B01001001);
      if (digit == 3)
        shiftOut(dataPin, clockPin, MSBFIRST, B01100001);
      if (digit == 4)
        shiftOut(dataPin, clockPin, MSBFIRST, B00110011);
      if (digit == 5)
        shiftOut(dataPin, clockPin, MSBFIRST, B00100101);
      if (digit == 6)
        shiftOut(dataPin, clockPin, MSBFIRST, B00000111);
      if (digit == 7)
        shiftOut(dataPin, clockPin, MSBFIRST, B11110001);
      if (digit == 8)
        shiftOut(dataPin, clockPin, MSBFIRST, B00000001);
      if (digit == 9)
        shiftOut(dataPin, clockPin, MSBFIRST, B00110001);
    
      //take the latch pin high so the LEDs will light up:
      digitalWrite(latchPin, HIGH);
    anyways, let us know a bit more about your hardware and we might be able to provide better / more directed assistance.

  7. Thanks MadMaori thanked for this post
  8. #6
    25+ Posting Member
    Join Date
    Apr 2012
    Location
    New Zealand
    Posts
    35
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wanted URGENT!!! Example 3 digit 7 segment led FSX Link2fs Sketch!!!

    Ah heck i thought id said im useing an Arduino mega to run em like jim does, i really just need any old sketch of heading or altitude , speed etc to work off, i even took my common cath leds back and swapped em for anode after seeing 9 out of 10 used anode instead, im really starting to bang my head on the wall here lol .... i even bought a bunch of 4511 ICs at one stage till i realised the arduino dosnt need them lol, so there they sit on the shelf laughing at me lol..


    P.S JIMNZ_TEST_COM1_COM2.pde which comes in Jims example ArdLinkFSinOUT_COM1_COM2.zip is perfect but dosnt have any reference to HDG, SPD or Alt, if someone could just show me how to change it to them instead i would marry you and make you very happy!!!! lol, thnx in advance guys ...

  9. #7
    25+ Posting Member
    Join Date
    Jun 2012
    Location
    Canada
    Posts
    34
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wanted URGENT!!! Example 3 digit 7 segment led FSX Link2fs Sketch!!!

    It would really help if you provided a bit more info. I diagram of how you have them wired to the controller would be the best.

    As I said, your sketch will look completely different depending on how you have them wired.

    There's a great example here http://www.mycockpit.org/forums/show...M1640-displays of working with values. He outputs his values to a 16 digit - 7 segment display which uses serial interface.

    As mentioned before, I am using shift registers and have shared a subset of the code. I would give you a better sketch, but I am still working on it. By using shift registers, I am going to try to be able to drive all 19 digits on my MCP plus the 8 output LEDs (Autothrottle Armed, etc) off of just 3 pins using 20 of the 74hc595 shift registers. my hope is it is fast enough, but initial testing (without everything hooked up) says it should be.

    If I have a few minutes tonight I will try and put together a sample sketch for using common annode digits WITHOUT a driver. But I really don't think you should go this route as it will quickly use up pins... For an MCP you would probably use around 30, plus 8 for LEDS, plus 10 for encoders, plus 9 for buttons and 2 for switches (don't quote me here....) So I guess with a MEGA you could probably get away with this. My NANO would be left full a long time ago.

    Anyways, if you confirm that you will not be using a driver I will see what I can come up with.

  10. #8
    25+ Posting Member
    Join Date
    Apr 2012
    Location
    New Zealand
    Posts
    35
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wanted URGENT!!! Example 3 digit 7 segment led FSX Link2fs Sketch!!!

    Well after much searching i was thinking multiplexing with 3 rotaries as well, so at this stage since i havnt got any displays at all yet im just trying for a simple 3 digit HDG set of common anode with no driver just running off my mega, i did buy a bunch of 4511's but to this point dunno why lol, as for card use well im anticipateing buying another mega or 2 this week or the next so shouldnt be short of digi pins, im still learning slowly trying sampled sketchs etc,i have the voltage coming off the arduino but also have 4 PC power supplys in the cockpit powering different leds and toggle switches so can also get 12v or 5v off them too if needed but in a nutshell its an arduino mega off my main pc reading off link2fs plugged into 3 7 segment common anode leds wired up in series with 3 common nodes and A to G wires connected to the megas digi output pins, if you think me going out to buy ICs will make this a ton easier im keen lol ... scuse me if i sound half asleep but i been up all night wireing up the overhead and am a bit fuzzy lol ...P.S i copied the charlie-plexing.jpg from the http://www.mycockpit.org/forums/show...ED-display-FSX posts ....!G
    Quote Originally Posted by Krusty View Post
    Itwould really help if you provided a bit more info. I diagram of how you have them wired to the controller would be the best.

    As I said, your sketch will look completely different depending on how you have them wired.

    There's a great example here http://www.mycockpit.org/forums/show...M1640-displays of working with values. He outputs his values to a 16 digit - 7 segment display which uses serial interface.

    As mentioned before, I am using shift registers and have shared a subset of the code. I would give you a better sketch, but I am still working on it. By using shift registers, I am going to try to be able to drive all 19 digits on my MCP plus the 8 output LEDs (Autothrottle Armed, etc) off of just 3 pins using 20 of the 74hc595 shift registers. my hope is it is fast enough, but initial testing (without everything hooked up) says it should be.

    If I have a few minutes tonight I will try and put together a sample sketch for using common annode digits WITHOUT a driver. But I really don't think you should go this route as it will quickly use up pins... For an MCP you would probably use around 30, plus 8 for LEDS, plus 10 for encoders, plus 9 for buttons and 2 for switches (don't quote me here....) So I guess with a MEGA you could probably get away with this. My NANO would be left full a long time ago.

    Anyways, if you confirm that you will not be using a driver I will see what I can come up with.

  11. #9
    25+ Posting Member
    Join Date
    Jun 2012
    Location
    Canada
    Posts
    34
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wanted URGENT!!! Example 3 digit 7 segment led FSX Link2fs Sketch!!!

    OK, that was a bit more work than I thought! LOL Regardless, I have a functional Sketch with hopefully what you are looking for.

    I only have a Duemilanove board, so you will likely want to change the pin numbers a bit, but the code is heavily commented so you should be able to change it up as you wish.

    Anyways, without further a due, I present my sample sketch...

    Code:
    // This is a sample sketch to show how one "MIGHT" connect multiple 7 Segment displays using a common annode 
    // without any form of a driver.  This is probably the LONG way around, but should help people understand 
    // how one might go about this.  Others probably have much more efficient code.  This is simply what I came up with
    // No liablility is assumed!
    // July 3rd, 2012
    // Dave Hunt
    
    int pinSegmentA = 2;        // Connect this pin to all 7-digit displays for the "A" segment
    int pinSegmentB = 3;        // Connect this pin to all 7-digit displays for the "B" segment
    int pinSegmentC = 4;        // Connect this pin to all 7-digit displays for the "C" segment
    int pinSegmentD = 5;        // Connect this pin to all 7-digit displays for the "D" segment
    int pinSegmentE = 6;        // Connect this pin to all 7-digit displays for the "E" segment
    int pinSegmentF = 7;        // Connect this pin to all 7-digit displays for the "F" segment
    int pinSegmentG = 8;        // Connect this pin to all 7-digit displays for the "G" segment
    
    int pinDigitHundreds = 9;   // Connect this pin to a resistor (around 100 ohms) and the other end of the resistor to 
    // the common annode pin of the 7-segment display for "Hundreds" Digit
    int pinDigitTens = 10;      // Connect this pin to a resistor (around 100 ohms) and the other end of the resistor to 
    // the common annode pin of the 7-segment display for "Tens" Digit
    int pinDigitOnes = 11;      // Connect this pin to a resistor (around 100 ohms) and the other end of the resistor to
    // the common annode pin of the 7-segment display for "Ones" Digit
    
    int apHeading = 0;          // This is a variable used to store the Auto Pilot Heading value recieved from Flight Simulator
    int apAltitude = 0;         // This is a variable used to store the Auto Pilot Altitude
    
    const boolean displayLeadingZeros = true; // This is a constant used to determine if we should be displaying leading zeros
    
    void setup() {
      // Initialize all of the output pins
      pinMode(pinSegmentA, OUTPUT);        // TOP of segment
      pinMode(pinSegmentB, OUTPUT);        // TOP RIGHT of segment
      pinMode(pinSegmentC, OUTPUT);        // BOTTOM RIGHT of segment
      pinMode(pinSegmentD, OUTPUT);        // BOTTOM of segment
      pinMode(pinSegmentE, OUTPUT);        // BOTTOM LEFT of segment
      pinMode(pinSegmentF, OUTPUT);        // TOP LEFT of segment
      pinMode(pinSegmentG, OUTPUT);        // MIDDLE of segment
      pinMode(pinDigitHundreds, OUTPUT);   // Common Annode of segment 1
      pinMode(pinDigitTens, OUTPUT);       // Common Annode of segment 2
      pinMode(pinDigitOnes, OUTPUT);       // Common Annode of segment 3
      
      // initialize the serial port and it's speed
      Serial.begin(115200);  
    }
    
    void loop() {
      // put your main code here, to run repeatedly: 
      displayValue(apHeading);    // continously display the value on the 7-segment displays
      
      // If there is data in the serial buffer than it should be read
      if (Serial.available() > 0) {
        ReadSerialInput();
      }
    }
    
    void ReadSerialInput () {
     // This function reads the values from the serial interface
     int j1;
     j1 = Serial.read();
     
     // Check for the "autopilot apHeading"
     if (j1 == 'r') {
       delay(11);  // It seems to require a small delay before reading the next character
       apHeading = 0;
       apHeading = AddSerialDigit (Serial.read(), apHeading);  // Read the first character and convert it to a digit which is attached to the integer
       apHeading = AddSerialDigit (Serial.read(), apHeading);  // Read the second character and convert it to a digit which is attached to the integer
       apHeading = AddSerialDigit (Serial.read(), apHeading);  // Read the third character and convert it to a digit which is attached to the integer
       // Serial.print("apHeading - ");
       // Serial.println(apHeading);
     }
     
     // Each reading required would be added here
     if (j1 == 'p') {
       delay(11);  // It seems to require a small delay before reading the next character
       apAltitude = 0;
       apAltitude = AddSerialDigit (Serial.read(), apAltitude);  // Read the first character and convert it to a digit which is attached to the integer
       apAltitude = AddSerialDigit (Serial.read(), apAltitude);  // Read the second character and convert it to a digit which is attached to the integer
       apAltitude = AddSerialDigit (Serial.read(), apAltitude);  // Read the third character and convert it to a digit which is attached to the integer
       apAltitude = AddSerialDigit (Serial.read(), apAltitude);  // Read the forth character and convert it to a digit which is attached to the integer
       apAltitude = AddSerialDigit (Serial.read(), apAltitude);  // Read the fith character and convert it to a digit which is attached to the integer
       // Serial.print("apAltitude - ");
       // Serial.println(apAltitude);
     }
    }
    
    int AddSerialDigit (int inByte, int inValue) {
     // this function add the incoming byte read from the serial port to an incoming value
     // example: inbyte is an integer of 3 and incoming value is 46 then the result is 463
      return ((inValue * 10) + CharToInteger(inByte)); 
    }
    
    int CharToInteger (int inByte) {
      // This function converts an incoming Char(byte) to an actual integer...
      
      switch (inByte) {
        case '1':
          return 1;
          break;
        case '2':
          return 2;
          break;
        case '3':
          return 3;
          break;
        case '4':
          return 4;
          break;
        case '5':
          return 5;
          break;
        case '6':
          return 6;
          break;
        case '7':
          return 7;
          break;
        case '8':
          return 8;
          break;
        case '9':
          return 9;
          break;
        default:
          return 0;
          break;
      }
    }
    
    void displayValue(int incomingValue) {
    
      boolean displayTens = false;                // This boolean is used to decide if we should show the tens digit.
      // in other word, the number may be 100 so the tens zero needs to be
      // displayed regardless of the value
    
        if ((incomingValue > 99) || (displayLeadingZeros == true)) {
        // If the value is greater than 99 than there is a hundreds digit to display
        // or we want to display a leading zero
    
        if (incomingValue > 299) {
          DisplayDigit (3, 1);                    // Display the number 3 in the hundreds place
          incomingValue = incomingValue - 300;    // subtract 300 from the value so we are leftover with the tens and ones
          displayTens = true;                     // we will need to display the tens value
        }
        else if (incomingValue > 199) {
          DisplayDigit (2, 1);                    // Display the number 2 in the hundreds place
          incomingValue = incomingValue - 200;    // subtract 200 from the value so we are leftover with the tens and ones
          displayTens = true;                     // we will need to display the tens value
        }
        else if (incomingValue > 99) {
          DisplayDigit (1, 1);                    // Display the number 1 in the hundreds place
          incomingValue = incomingValue - 100;    // subtract 300 from the value so we are leftover with the tens and ones
          displayTens = true;                     // we will need to display the tens value
        }
        else {
          DisplayDigit (0, 1);                    // Display the number 0 in the hundreds place
        }
      }
      if ((incomingValue > 9) || (displayLeadingZeros == true) || (displayTens = true)) {
        // If the value is greater than 99 than there is a hundreds digit to display
        // or we want to display a leading zero
    
        if (incomingValue > 89) {
          DisplayDigit (9, 2);                    // Display the number 9 in the tens place
          incomingValue = incomingValue - 90;    // subtract 90 from the value so we are leftover with the ones
        }
        else if (incomingValue > 79) {
          DisplayDigit (8, 2);                    // Display the number 8 in the tens place
          incomingValue = incomingValue - 80;    // subtract 80 from the value so we are leftover with the tens and ones
        }
        else if (incomingValue > 69) {
          DisplayDigit (7, 2);                    // Display the number 7 in the tens place
          incomingValue = incomingValue - 70;    // subtract 70 from the value so we are leftover with the tens and ones
        }
        else if (incomingValue > 59) {
          DisplayDigit (6, 2);                    // Display the number 6 in the tens place
          incomingValue = incomingValue - 60;    // subtract 60 from the value so we are leftover with the tens and ones
        }
        else if (incomingValue > 49) {
          DisplayDigit (5, 2);                    // Display the number 5 in the tens place
          incomingValue = incomingValue - 50;    // subtract 50 from the value so we are leftover with the tens and ones
        }
        else if (incomingValue > 39) {
          DisplayDigit (4, 2);                    // Display the number 4 in the tens place
          incomingValue = incomingValue - 40;    // subtract 40 from the value so we are leftover with the tens and ones
        }
        else if (incomingValue > 29) {
          DisplayDigit (3, 2);                    // Display the number 3 in the tens place
          incomingValue = incomingValue - 30;    // subtract 30 from the value so we are leftover with the tens and ones
        }
        else if (incomingValue > 19) {
          DisplayDigit (2, 2);                    // Display the number 2 in the tens place
          incomingValue = incomingValue - 20;    // subtract 20 from the value so we are leftover with the tens and ones
        }
        else if (incomingValue > 9) {
          DisplayDigit (1, 2);                    // Display the number 1 in the tens place
          incomingValue = incomingValue - 10;    // subtract 10 from the value so we are leftover with the tens and ones
        }
        else {
          DisplayDigit (0, 2);                    // Display the number 0 in the tens place
        }
      }
    
      if (incomingValue > 8) {
        DisplayDigit (9, 3);                    // Display the number 9 in the ones place
      }
      else if (incomingValue > 7) {
        DisplayDigit (8, 3);                    // Display the number 8 in the ones place
      }
      else if (incomingValue > 6) {
        DisplayDigit (7, 3);                    // Display the number 7 in the ones place
      }
      else if (incomingValue > 5) {
        DisplayDigit (6, 3);                    // Display the number 6 in the ones place
      }
      else if (incomingValue > 4) {
        DisplayDigit (5, 3);                    // Display the number 5 in the ones place
      }
      else if (incomingValue > 3) {
        DisplayDigit (4, 3);                    // Display the number 4 in the ones place
      }
      else if (incomingValue > 2) {
        DisplayDigit (3, 3);                    // Display the number 3 in the ones place
      }
      else if (incomingValue > 1) {
        DisplayDigit (2, 3);                    // Display the number 2 in the ones place
      }
      else if (incomingValue > 0) {
        DisplayDigit (1, 3);                    // Display the number 1 in the ones place
      }
      else {
        DisplayDigit (0, 3);                    // Display the number 0 in the ones place
      }
    
    
    
    }
    
    
    void DisplayDigit(int DigitToDisplay, int PlaceToDisplay) {
      // This function displays a digit in a location
      // digit should be 0 through 9
      // place should be 1 through 3 (1 being hundred, 2 being tens, 3 being ones place holder)
    
      // Turn Off All Digits
      digitalWrite(pinDigitHundreds, LOW);    // turn the Hundreds Digit Off
      digitalWrite(pinDigitTens, LOW);        // turn the Tens Digit Off
      digitalWrite(pinDigitOnes, LOW);        // turn the Ones Digit Off
    
      switch (DigitToDisplay) {
      case 0: 
        {
          digitalWrite(pinSegmentA, LOW);    // TOP
          digitalWrite(pinSegmentB, LOW);    // TOP RIGHT
          digitalWrite(pinSegmentC, LOW);    // BOTTOM RIGHT
          digitalWrite(pinSegmentD, LOW);    // BOTTOM
          digitalWrite(pinSegmentE, LOW);    // BOTTOM LEFT
          digitalWrite(pinSegmentF, LOW);    // TOP LEFT
          digitalWrite(pinSegmentG, HIGH);   // MIDDLE
          break;
        }
      case 1: 
        {
          digitalWrite(pinSegmentA, HIGH);   // TOP
          digitalWrite(pinSegmentB, LOW);    // TOP RIGHT
          digitalWrite(pinSegmentC, LOW);    // BOTTOM RIGHT
          digitalWrite(pinSegmentD, HIGH);   // BOTTOM
          digitalWrite(pinSegmentE, HIGH);   // BOTTOM LEFT
          digitalWrite(pinSegmentF, HIGH);   // TOP LEFT
          digitalWrite(pinSegmentG, HIGH);   // MIDDLE
          break;
        }
      case 2: 
        {
          digitalWrite(pinSegmentA, LOW);    // TOP
          digitalWrite(pinSegmentB, LOW);    // TOP RIGHT
          digitalWrite(pinSegmentC, HIGH);   // BOTTOM RIGHT
          digitalWrite(pinSegmentD, LOW);    // BOTTOM
          digitalWrite(pinSegmentE, LOW);    // BOTTOM LEFT
          digitalWrite(pinSegmentF, HIGH);   // TOP LEFT
          digitalWrite(pinSegmentG, LOW);    // MIDDLE
          break;
        }
      case 3: 
        {
          digitalWrite(pinSegmentA, LOW);    // TOP
          digitalWrite(pinSegmentB, LOW);    // TOP RIGHT
          digitalWrite(pinSegmentC, LOW);    // BOTTOM RIGHT
          digitalWrite(pinSegmentD, LOW);    // BOTTOM
          digitalWrite(pinSegmentE, HIGH);   // BOTTOM LEFT
          digitalWrite(pinSegmentF, HIGH);   // TOP LEFT
          digitalWrite(pinSegmentG, LOW);    // MIDDLE
          break;
        }
      case 4: 
        {
          digitalWrite(pinSegmentA, HIGH);   // TOP
          digitalWrite(pinSegmentB, LOW);    // TOP RIGHT
          digitalWrite(pinSegmentC, LOW);    // BOTTOM RIGHT
          digitalWrite(pinSegmentD, HIGH);   // BOTTOM
          digitalWrite(pinSegmentE, HIGH);   // BOTTOM LEFT
          digitalWrite(pinSegmentF, LOW);    // TOP LEFT
          digitalWrite(pinSegmentG, LOW);    // MIDDLE
          break;
        }
      case 5: 
        {
          digitalWrite(pinSegmentA, LOW);    // TOP
          digitalWrite(pinSegmentB, HIGH);   // TOP RIGHT
          digitalWrite(pinSegmentC, LOW);    // BOTTOM RIGHT
          digitalWrite(pinSegmentD, LOW);    // BOTTOM
          digitalWrite(pinSegmentE, HIGH);   // BOTTOM LEFT
          digitalWrite(pinSegmentF, LOW);    // TOP LEFT
          digitalWrite(pinSegmentG, LOW);    // MIDDLE
          break;
        }
      case 6: 
        {
          digitalWrite(pinSegmentA, LOW);    // TOP
          digitalWrite(pinSegmentB, HIGH);   // TOP RIGHT
          digitalWrite(pinSegmentC, LOW);    // BOTTOM RIGHT
          digitalWrite(pinSegmentD, LOW);    // BOTTOM
          digitalWrite(pinSegmentE, LOW);    // BOTTOM LEFT
          digitalWrite(pinSegmentF, LOW);    // TOP LEFT
          digitalWrite(pinSegmentG, LOW);    // MIDDLE
          break;
        }
      case 7: 
        {
          digitalWrite(pinSegmentA, LOW);    // TOP
          digitalWrite(pinSegmentB, LOW);    // TOP RIGHT
          digitalWrite(pinSegmentC, LOW);    // BOTTOM RIGHT
          digitalWrite(pinSegmentD, HIGH);   // BOTTOM
          digitalWrite(pinSegmentE, HIGH);   // BOTTOM LEFT
          digitalWrite(pinSegmentF, HIGH);   // TOP LEFT
          digitalWrite(pinSegmentG, HIGH);   // MIDDLE
          break;
        }
      case 8: 
        {
          digitalWrite(pinSegmentA, LOW);    // TOP
          digitalWrite(pinSegmentB, LOW);    // TOP RIGHT
          digitalWrite(pinSegmentC, LOW);    // BOTTOM RIGHT
          digitalWrite(pinSegmentD, LOW);    // BOTTOM
          digitalWrite(pinSegmentE, LOW);    // BOTTOM LEFT
          digitalWrite(pinSegmentF, LOW);    // TOP LEFT
          digitalWrite(pinSegmentG, LOW);    // MIDDLE
          break;
        }
      case 9: 
        {
          digitalWrite(pinSegmentA, LOW);    // TOP
          digitalWrite(pinSegmentB, LOW);    // TOP RIGHT
          digitalWrite(pinSegmentC, LOW);    // BOTTOM RIGHT
          digitalWrite(pinSegmentD, HIGH);   // BOTTOM
          digitalWrite(pinSegmentE, HIGH);   // BOTTOM LEFT
          digitalWrite(pinSegmentF, LOW);    // TOP LEFT
          digitalWrite(pinSegmentG, LOW);    // MIDDLE
          break;
        }
      }
    
      switch(PlaceToDisplay) {
      case 1: 
        {
          digitalWrite(pinDigitHundreds, HIGH);    // turn the Hundreds Digit ON
          break;
        }
      case 2: 
        {
          digitalWrite(pinDigitTens, HIGH);        // turn the Tens Digit ON
          break;
        }
      case 3: 
        {
          digitalWrite(pinDigitOnes, HIGH);        // turn the Ones Digit ON
          break;
        }
      }
    
      // wait 5 milliseconds, this makes sure that the digit is shown long enough before looping
      delay(5); 
    }

  12. Thanks MadMaori thanked for this post
  13. #10
    25+ Posting Member
    Join Date
    Jun 2012
    Location
    Canada
    Posts
    34
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Wanted URGENT!!! Example 3 digit 7 segment led FSX Link2fs Sketch!!!

    I should have mentioned, the spec sheet for the 7-segment displays I am using can be found here.

    http://www.techno-star.biz/diodes/tdsr3160.pdf

Page 1 of 4 1234 LastLast