Hello,
I’ll try to hide the first “0” on arduino code demonstrates how to post two numbers to a 2-digit display usings two large digit driver boards.
I want to hide the first 0 when we display “01”, but i can not do it
Can you help me ?
Code on
https://github.com/sparkfun/Large_Digit … xample.ino
Thanks
Olivier
That’s known as “leading zero blanking”. Normally when I do this, I go the other way (high digits to low digits), and have a blanking flag that starts as “true” and is set to “false” when I encounter the first non-zero digit or get to the last digit (so as not to blank the entire display). When displaying a digit, I check the flag and only disply the digit if the flag is false. However, this would be a large rewrite to your code (expecially as it looks like the large digit driver goes the other way).
Therefore, I’d just do it the quick and dirty way, and take advantage of the fact that there are only two digits and you only need to blank one of them if it’s a zero. In the for() loop in showNumber(), before the call to postNumber(), I’d add something like:
if ((byte == 1) && (remainder == 0)) {
// leading digit is zero, blank it
remainder = ’ ';
}
This checks to see if it’s the first digit and it’s a zero, and if so, it replaces the number with a space. Fortunately, the postNumber() routine has code to display nothing when given a space instead of a number.