Page 1 of 7 12345 ... LastLast
Results 1 to 10 of 68
  1. #1
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Lightbulb NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)

    I have studied the JMeller's "FINAL_NAV_COM", but have difficulty understanding what is happening inside the sketsj.
    I did not even get it to work!
    It's possible I'm slow, but I hope Iím not the only one.
    Therefore I was wondering if there could be another way to attack the problem.
    The thing I wondering is: Is it possible to set up the different numbers, from zero to eight eg. in a Arrey (or a way to store thes values).

    Code:
    DIGIT0,  
    digitalWrite(pinA, B1);
    digitalWrite(pinB, B1);
    digitalWrite(pinC, B1);
    digitalWrite(pinD, B1);
    digitalWrite(pinE, B1);
    digitalWrite(pinF, B1);
                  digitalWrite(pinG, B0);                             
                                     
    DIGIT1,  
    digitalWrite(pinA, B0);
    digitalWrite(pinB, B1);
    digitalWrite(pinC, B1);
    digitalWrite(pinD, B0);
    digitalWrite(pinE, B0);
    digitalWrite(pinF, B0);
    digitalWrite(pinG, B0);
     
    DIGIT2, 
    digitalWrite(pinA, B1);
    digitalWrite(pinB, B1);
    digitalWrite(pinC, B0);
    digitalWrite(pinD, B1);
    digitalWrite(pinE, B1);
    digitalWrite(pinF, B0);
    digitalWrite(pinG, B1);
    
    And so on, to the DIGIT8...............................................
    Then writing the Common anode HIGH / LOW as neaded when reseaving from Link2fs_multi.
    Here Iím using 5 SSDís
    Code:
    digitalWrite(SSD1gnd, B0); //This is the active SSD                       
    digitalWrite(SSD2gnd, B1);
    digitalWrite(SSD3gnd, B1);
    digitalWrite(SSD4gnd, B1);
    digitalWrite(SSD5gnd, B1);
    Setting this up in a sketsj I can write 0, 1 and 2, on the first 3 SSDís with the code like this:
    Code:
      
    DIGIT0,  
    digitalWrite(pinA, B1);
    digitalWrite(pinB, B1);
    digitalWrite(pinC, B1);
    digitalWrite(pinD, B1);
    digitalWrite(pinE, B1);
    digitalWrite(pinF, B1);
    digitalWrite(pinG, B0);
                           digitalWrite(SSD1gnd, B0); //The code goes to the 1. Digit                       
                           digitalWrite(SSD2gnd, B1);
                           digitalWrite(SSD3gnd, B1);
                                     
    DIGIT1,  
    digitalWrite(pinA, B0);
    digitalWrite(pinB, B1);
    digitalWrite(pinC, B1);
    digitalWrite(pinD, B0);
    digitalWrite(pinE, B0);
    digitalWrite(pinF, B0);
    digitalWrite(pinG, B0);
                           digitalWrite(SSD1gnd, B1);                        
                           digitalWrite(SSD2gnd, B0);//The code goes to the 2. Digit
                           digitalWrite(SSD3gnd, B1);
     
    DIGIT2,  
    digitalWrite(pinA, B1);
    digitalWrite(pinB, B1);
    digitalWrite(pinC, B0);
    digitalWrite(pinD, B1);
    digitalWrite(pinE, B1);
    digitalWrite(pinF, B0);
    digitalWrite(pinG, B1);
                           digitalWrite(SSD1gnd, B1);                        
                           digitalWrite(SSD2gnd, B1);
                           digitalWrite(SSD3gnd, B0); //The code goes to the 3. Digit
    Thus I was wondering if one could receive Com1 (= A) from Link2fs_multi, retrieve the value eg (118,300 only use 118.30 for 5 SSD's).
    And then deciding which Common's to show the stored value (DIGIT)

    IE: OBS! This is not a working code but a brainstorming!
    Code:
    Serial.read(); 118.30
    (digitalWrite SSD1 + DIGIT1), 
    (digitalWrite SSD2 + DIGIT1)
    (digitalWrite SSD3 + DIGIT8 + Desimal "DP") 
    (digitalWrite SSD4 + DIGIT3)
    (digitalWrite SSD5 + DIGIT0)
    This way one could make a code that "slow-downs" like me could understand what is going on in the sketsj.
    Do not be afraid to say that I'm on the wrong track with this idea.
    But suggestions is received with pleasure
    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
    231
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)

    Roy,
    I soooo apologize. That was my first finished product at my first crack of the arduino code; it's a long daunting mess!

    I agree with you... arrays seem to be a better way to go. So, to pay pennance, I decided to offer up this theory:

    Code:
    void setup {
    ... usual setup stuff
    comAnode = 9  // define first anode of com1 
    // comAnodes are pins 9, 10, 11, 12;  this assumes 1wx.yz0; 1, decimal, & 0 are static
    }  // end setup
    
    
    void loop() {
    ... linkFS stuff
    
    com1 [0] = char(Serial.read()-48);
    com1 [1] = char(Serial.read()-48);
    com1 [2] = char(Serial.read()-48);
    com1 [3] = char(Serial.read()-48);  // decimal point
    com1 [4] = char(Serial.read()-48);
    com1 [5] = char(Serial.read()-48);
    com1 [6] = char(Serial.read()-48);
    LEDstates(); // fetch method
    } // end loop
    
    
    
    
    void LEDstates(){
    
    
     for (int i = 1; i < 6; i++)  {  // does not read first digit com1 [0] or last digit com1 [6]
    
    
    // Note: need to disregard decimal at com1 [3]
    
        switch (com1 [i]) {
        case 0:
           led[6] = {1,1,1,1,1,1,0};  //{a,b,c,d,e,f,g}  creates '0'
        LightSEG();
        
        case 1:
          led[6] = {0,1,1,0,0,0,0};  //{a,b,c,d,e,f,g}  creates '1'
        LightSEG()
       
       ... etc.
    if (comAnode  < 13) {comAnode = comAnode + 1;}else{ comAnode = 9;}
      }
    }// end LEDstates
    
    
    void LightSEG(){
    
     digitalWrite (Pin2, led[0]);  // a segment
     digitalWrite (Pin3, led[1]);  // b segment
     digitalWrite (Pin4, led[2]);  // c segment
     digitalWrite (Pin5, led[3]);  // d segment
     digitalWrite (Pin6, led[4]);  // e segment
     digitalWrite (Pin7, led[5]);  // f segment
     digitalWrite (Pin8, led[6]);  // g segment
     WriteAnode();
    
    } //end LightSEG
    
    
    void WriteAnode() {
        digitalWrite ({comAnode , HIGH);
        delay(30);  adjust accordingly to avoid eye detected number blink
        digitalWrite ({comAnode , LOW);
    }// end WriteAnode
    Hope this helps. Be prepared for A LOT of tedious soldering!!

  3. #3
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)

    Hi James.
    I have to crawl to the cross to ask for an explanation
    I do not know if this phrase originates from programming language, or whether it is directly related to the SSD's

    < this assumes 1wx.yz0; >

    But I had appreciated an explanation



    I'll just sit there staring at this statement except I do not understand what it tells me!


    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  4. #4
    150+ Forum Groupie
    Join Date
    Apr 2011
    Location
    United States of America
    Posts
    231
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)

    lol - no, it is I who had to pay for my wrong doing.

    Anyway, 1wx.yz0 is a shorthand picture of the variable com freq layout:

    In my setup, the first digit and the last digit are hardwired to never change. Example: 122.250 - the first digit is always "1" and the last digit is always "0"; to save outputs, they are hardwired to be static numbers; the decimal point is also static and should be hardwired to always be lit. This was a tip geneb gave me.

    Therefore, wxyz (2225) are the numbers which will change via Link2FS; the segments (a-g) and the four anode pins( or cathodes) are connected to
    the arduino outputs.

    Hope this cleared up the confusion.

  5. #5
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)

    JEY! Now we can talk (the same language)
    TX. for that explanation. It's weird how small stone can fell great oaks
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  6. #6
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)

    I'm back with some nagging James
    I tried to put the code in a sketsh and this came up?
    I have unfortunately not the skills to see the error.
    08-11-2013 21-16-11.png
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  7. #7
    150+ Forum Groupie
    Join Date
    Apr 2011
    Location
    United States of America
    Posts
    231
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)

    Ha. It's important thing to remember is what I typed up was only a theory; it was never placed into a sketch - much less tested.

    That said, the line highlighted appears not to like the led array. Was it declared as an array at the top of the sketch?

    The second error I noticed was that there is a missing bracket "}" to close the LEDstates method. Yeah, I know it shows one with the comment "// end LEDstates" - simply add a "}" above that.

    Next I noticed I did not close my second statement under Case1 with the semicolon.

    Next I noticed "... etc" in line 45.

    The theory I proposed was not meant to be a copy, paste and everything works. It was meant to be a guide using the knowledge I have learned since the original pde.

  8. #8
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)

    Hi James.
    The day has been used in reading on webpages, about SSD's and Led's
    Don't think I'm getting anyway!
    Is it possible to set up the "Digits" and the "Segments"in an Arrey, this way?
    Code:
    //10 Digits (0-9) and 7 Segments.
    
    byte Digits_Segments[10][7] = { 
           { 1,1,1,1,1,1,0 },  // = 0
           { 0,1,1,0,0,0,0 },  // = 1
           { 1,1,0,1,1,0,1 },  // = 2
           { 1,1,1,1,0,0,1 },  // = 3
           { 0,1,1,0,0,1,1 },  // = 4
           { 1,0,1,1,0,1,1 },  // = 5
           { 1,0,1,1,1,1,1 },  // = 6
           { 1,1,1,0,0,0,0 },  // = 7
           { 1,1,1,1,1,1,1 },  // = 8
           { 1,1,1,0,0,1,1 }}; // = 9
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  9. #9
    150+ Forum Groupie
    Join Date
    Apr 2011
    Location
    United States of America
    Posts
    231
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)

    Roy,
    I can't say... I've never used the format. However, after viewing your code, it occurred to me that I used a zero based definition to define the array for led. It should be as follows:

    case 0:
    led[7] = {1,1,1,1,1,1,0}; //{a,b,c,d,e,f,g} creates '0'
    LightSEG();

    below was my error:L
    case 0:
    led[ 6 ] = {1,1,1,1,1,1,0}; //{a,b,c,d,e,f,g} creates '0'
    LightSEG();

    Note: define arrays as whole numbers (greater than zero); read arrays as zero based

    This could explain the exception that was thrown in your earlier post. Perhaps, I should build actually take the time to sketch and build example code rather than just throw it out there from the top of my head!

    Below is the theory built in the sketch with no errors; insert your code need to read from Link2FS .
    Code:
    int com1[7];
    int led[7];
    int comAnode;
    
    
    int Pin2 = 2;
    int Pin3 = 3;
    int Pin4 = 4;
    int Pin5 = 5;
    int Pin6 = 6;
    int Pin7 = 7;
    int Pin8 = 8;
    
    
    void setup(){
     // your setup stuff here 
    }
    
    
    
    
    void loop() {
    // Link2FS stuff here
    com1 [0] = char(Serial.read()-48);
    com1 [1] = char(Serial.read()-48);
    com1 [2] = char(Serial.read()-48);
    com1 [3] = char(Serial.read()-48);  // decimal point
    com1 [4] = char(Serial.read()-48);
    com1 [5] = char(Serial.read()-48);
    com1 [6] = char(Serial.read()-48);
    LEDstates(); // fetch method
    } // end loop
    
    
    
    
    
    
    
    
    void LEDstates(){
    
    
    
    
     for (int i = 1; i < 6; i++)  {  // does not read first digit com1 [0] or last digit com1 [6]
    
    
    
    
    // Note: need to disregard decimal at com1 [3]
    
    
        switch (com1 [i]) {
        case 0:
           led[7] = (1,1,1,1,1,1,0);  //{a,b,c,d,e,f,g}  creates '0'
        LightSEG();
        
        case 1:
          led[7] = (0,1,1,0,0,0,0);  //{a,b,c,d,e,f,g}  creates '1'
        LightSEG();
       
      if (comAnode  < 13) {comAnode = comAnode + 1;}else{ comAnode = 9;}
      }
     }
    }// end LEDstates
    
    
    
    
    void LightSEG(){
    
    
     digitalWrite (Pin2, led[0]);  // a segment
     digitalWrite (Pin3, led[1]);  // b segment
     digitalWrite (Pin4, led[2]);  // c segment
     digitalWrite (Pin5, led[3]);  // d segment
     digitalWrite (Pin6, led[4]);  // e segment
     digitalWrite (Pin7, led[5]);  // f segment
     digitalWrite (Pin8, led[6]);  // g segment
     WriteAnode();
    
    
    } //end LightSEG
    
    
    
    
    void WriteAnode() {
        digitalWrite (comAnode , HIGH);
        delay(30); // adjust accordingly to avoid eye detected number blink
        digitalWrite (comAnode , LOW);
    }// end WriteAnode
    Happy coding!
    JM

  10. #10
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING)

    Hi James.

    Only working with hardware before I started with Arduino, I really have trouble to learn the terms: "Reference: structure, values​​, and functions.
    I see an "int" and automatically goes: "initialize!".
    I'm trying to put the different parts of your suggestions into the (Multi_Basic_Concept.ino), and it's hard to get my head focused.
    But I'm trying, and it's fun thoug!

    A thought:
    This line: //Note: need to disregard decimal at com1 [3]
    Can it be done with a bolean "!" (not), like this: !3;
    in the line:
    for (int i = 1; i i < 6; i++) // does not read first digit com1[0], or last digit com1 [6]

    EDIT:
    Also: can You explain this:
    if (comAnode < 13) {comAnode = comAnode + 1;}else{ comAnode = 9;}

    What does the digit's refer to?
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

Page 1 of 7 12345 ... LastLast