Go Down

Topic: Colon on 4 digit 7 segment display (Read 1 time) previous topic - next topic

veedub88

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);
      }
    }
  }

bilbo

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

veedub88


bilbo

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.
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

veedub88

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.

Go Up