-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to show colon? #9
Comments
You can send the colon as a decimal value 0b01000000 using the showNumberDec() function. Here is an example minute:second counter. Would love to see your code. #include <TM1637TinyDisplay.h>
// Useful Time Macros
#define numberOfSeconds(_time_) (_time_ % 60UL)
#define numberOfMinutes(_time_) ((_time_ / 60UL) % 60UL)
#define numberOfHours(_time_) (( _time_% (3600UL * 24L)) / 3600UL)
#define elapsedDays(_time_) ( _time_ / (3600UL * 24L))
#define OFFSET (10UL * 60UL + 55UL) // start at 10m:55s
// Define Digital Pins
#define CLK 3
#define DIO 4
TM1637TinyDisplay display(CLK, DIO);
void setup() {
display.setBrightness(0x0f);
}
void loop() {
unsigned long timenow = (millis() / 1000) + OFFSET;
int days = elapsedDays(timenow);
int hours = numberOfHours(timenow);
int minutes = numberOfMinutes(timenow);
int seconds = numberOfSeconds(timenow);
if ((seconds % 2) == 0) { // flash colon every other second
display.showNumberDec(((minutes * 100) + seconds), 0b01000000, true); // turn on colon
}
else {
display.showNumberDec(((minutes * 100) + seconds), 0b00000000, true); // turn off colon
}
} |
Great, thanks :) Here is my code: if (hour24) display.showNumberDec(hour(), second() % 2 * 0b01000000, true, 2, 0);
else display.showNumberDec(hourFormat12(), second() % 2 * 0b01000000, false, 2, 0);
display.showNumber(minute(), true, 2, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! I have a display from eBay which has the 4 digits and the colon in the middle. I've been reading through but can't figure out how to get the colon to flash. I'm obviously missing something but I don't know what? Any suggestions?
I am trying to make a clock and using the Time library i have done:
and would like to have the colon flash between the hour and minute
The text was updated successfully, but these errors were encountered: