Skip to content

Time not visible on screen #17

@Egauss

Description

@Egauss

have some kind code, but cant sort out where are problem

two first segments showing seconds and minutes missing, time cursor missing as well,
when time less 10 sec = 90 but must by 09

#include <SevenSegmentTM1637.h>
const byte PIN_CLK = 12; // define CLK pin (any digital pin)
const byte PIN_DIO = 11; // define DIO pin (any digital pin)
SevenSegmentTM1637 display(PIN_CLK, PIN_DIO);

#include <CountUpDownTimer.h>
CountUpDownTimer T(DOWN);

int led = 13;
int hourT;
int minutesT;
int secondsT;
int hourDisp;
int minutesDisp;
int secondsDisp;
int hNTS;
int mNTS;
int sNTS;
String HST;
String MNT;
String SNT;

// run setup code
void setup() {
Serial.begin(9600); // initializes the Serial connection @ 9600 baud
display.begin(); // initializes the display
display.setBacklight(100); // set the brightness to 100 %

pinMode(led, OUTPUT);

display.print("....");
display.blink(3000);
display.clear();
T.StartTimer();
T.SetTimer(120);
}

void loop() {
T.Timer();

digitalWrite(led, HIGH);

if (T.TimeHasChanged() ) // this prevents the time from being constantly shown.
{

//display.print(T.ShowHours());
display.print(T.ShowMinutes());
display.print(T.ShowSeconds());

Serial.print(T.ShowHours());
Serial.print(":");
Serial.print(T.ShowMinutes());
Serial.print(":");
Serial.print(T.ShowSeconds());

minutesT = T.ShowMinutes();
secondsT = T.ShowSeconds();
if (minutesT == 0 && secondsT == 0) {
T.StopTimer();
digitalWrite(led, LOW);
delay(10000);
display.off();
}
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions