Pages: [1]   Go Down
Author Topic: Colon on 4 digit 7 segment display  (Read 1707 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, so I have put together a 2 minute countdown timer using an Arduino Uno, Max7221, and a 4 digit 7 segment LED display (also has periods and a colon).  However I can't figure out how to make the colon light up.  Any suggestions?




#include <LedControl.h>    //We cant do anything without importing a suitable library!

// Lets start with the pinouts to the Max72xx led driver
// *****************************************************

int DIN = 11;              // Pin 1  on the Max72xx
int CLK = 13;              // Pin 13 on the Max72xx
int LOADCS = 10;           // Pin 12 on the Max72xx

int flashDelay = 100;      // delay in MS (100=1/10th second)
int ledBrightness = 15;    // range is 0-15.  0=lowest, 15 = full power

// define the LedControl instance - if I want more I can setup lc2, lc3 etc
// ************************************************************************

LedControl lc=LedControl(DIN,CLK,LOADCS,1);    // DIN, CLK, Load/CS, 1 = only one chip MAX chip attached.

void setup()                   
{
  pinMode(DIN, OUTPUT);        // once only, lets make the pins outputs
  pinMode(CLK, OUTPUT);
  pinMode(LOADCS, OUTPUT);

  // take pins out of power save mode.  No updates otherwise.
  for(int index=0;index<lc.getDeviceCount();index++) {
    lc.shutdown(index,false);
  }

  lc.setIntensity(0,ledBrightness  ); //set the brightness
}

void loop()                     // here comes the good stuff, the main loop!
{
  int row = 0;                  //Set the starting position
  int chipId = 0;               //This is not strictly reqd, but if using more than one display this will be needed



    //  Now the minutes
    for (int minutecountdown=1; minutecountdown >=0; minutecountdown--){
      int y=minutecountdown;
      int minuteones;
      minuteones=y%10;
     
     
      lc.setDigit(chipId, row+1, minuteones, false);         // These two lines add the numerical hours
   

      //  And the seconds
      for (int seccountdown=600; seccountdown>0; seccountdown--)
      {
        int v=seccountdown;
        int secones;
        int sectens;
        secones=v/10%10;                                     
        sectens=v/100%10;
             
        lc.setDigit(chipId, row+3, (byte) secones, false);    // True in the arguments activates the dot...
        lc.setDigit(chipId, row+2, (byte) sectens, false);
        delay (flashDelay);
      }
    }
  }
Logged

0
Offline Offline
Sr. Member
****
Karma: 2
Posts: 360
I'm 15. I like making things. I like breaking things better.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What display are you using?
Logged

Alice asked the Chesire Cat, who was sitting in a tree, "What road do I take?"
The cat asked, "Where do you want to go?"
"I don't know," Ali

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Liteon LTC-4727JR common cathode
Logged

0
Offline Offline
Sr. Member
****
Karma: 2
Posts: 360
I'm 15. I like making things. I like breaking things better.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It seems you will have to treat the points in the colon as an extra digit. See the datasheet of your LED: http://www.datasheetarchive.com/pdf-datasheets/Datasheets-305/79783.html . L1, 2, and 3 share a common cathode, and share anodes with A, B and C.
Logged

Alice asked the Chesire Cat, who was sitting in a tree, "What road do I take?"
The cat asked, "Where do you want to go?"
"I don't know," Ali

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, so will pin 4 of the display go to a pin on the Max7221 and get controlled by the code?  I can tie pin 4 to ground and the colon and L3 light up but i don't want L3 to light up.  L3 is at the top between the 3rd and 4th digit.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8589
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

These displays are a PITA, the degrees led and the colon all wired in parallel so you have to physically blank out L3 with a marker or some tape or something.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 39
Posts: 4384
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you decide to change displays then one 'trick' that used to be used was to use devices with right hand decimal points to create colons.  The display for the tens of minutes was installed upside down so it's decimal point was in the upper left, roughly above the decimal point for the ones of hours display.  By turning both decimal points on you got a colon.  Of course you would have to redefine the segment letters but I believe that many of the displays were symmetrical in that respect.  You could also do this with left hand decimal point devices by turning the other display upside down.

Don
Logged

Pages: [1]   Go Up
Jump to: