7 Segment - Writing a Decimal Point with matrix.print

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
pilbromatic
 
Posts: 14
Joined: Sat Nov 10, 2012 2:16 am

7 Segment - Writing a Decimal Point with matrix.print

Post by pilbromatic »

Hi everyone,

Pretty stuck with this; done loads of Googling but can't figure it out! I'm trying to write a decimal point in the lower right-hand corner of the 7-seg display, which will in turn differentiate between AM or PM. Using writeDigitNum works on it's own, but I'm using matrix.print and want to illuminate the DP with this.

One way I can think of; where I've put the '???' possibly there is some form of placeholder that can go here to tell it not to change the existing variable...?

Code: Select all

  matrix.print(hour() * 100 + minute());
  matrix.writeDigitNum(4, ???, true);
  matrix.writeDisplay();
I've simplified the code a little to make it easier to see what we're working with.

Any ideas? Thanks!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: 7 Segment - Writing a Decimal Point with matrix.print

Post by adafruit_support_rick »

I'm afraid you're going to have to do it the hard way and not use matrix.print. You'll have to write the digits out individually with writeDigitNum.

User avatar
pilbromatic
 
Posts: 14
Joined: Sat Nov 10, 2012 2:16 am

Re: 7 Segment - Writing a Decimal Point with matrix.print

Post by pilbromatic »

Huh, well that's no fun! I think for this project I'll just add a separate 3mm LED. :)

Thanks for your help!

User avatar
bhailer
 
Posts: 1
Joined: Sun Jul 12, 2015 2:41 pm

Re: 7 Segment - Writing a Decimal Point with matrix.print

Post by bhailer »

Using the writeDigitNum function to get a decimal in the far right place isn't all that bad. For my clock application I used the following to get 12-hour time format with a decimal in the far right for PM times.

Code: Select all

    int hr_24, hr_12;
    hr_24=now.hour();
    if (hr_24==0) {hr_12=12;}
    else hr_12=hr_24%12;
    int time=hr_12 * 100 + now.minute();
    matrix.print(time);
    matrix.drawColon(true);
    if (now.hour()>=12) matrix.writeDigitNum(4,now.minute() % 10,true);
    matrix.writeDisplay();
Probably a bit late for the original poster but might help someone else with a similar issue.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”