Reply to topic  [ 11 posts ]  Go to page Previous  1, 2
MAX7219 8 Digit Seven Segment Display Module (HCMODU0082) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 629
Post Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082
You could simply pad the value with a zero if it's less than 10. Here is an (untested) example:


Code:
void loop()
{
  for(byte Seconds = 0; Seconds < 60; Seconds++)
  {
    Disp2DigNum(Seconds, 8);

    HCMAX7219.Refresh(); 
    delay(1000);
  }
}


void Disp2DigNum(int Number, byte Pos)
{
  if(Number < 10)
  {
    HCMAX7219.print7Seg((long)0, Pos);
    HCMAX7219.print7Seg(Number, --Pos);
  }else
  {
    HCMAX7219.print7Seg(Number, Pos);
  }
}

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Tue Jul 19, 2016 9:22 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD