Skip to content
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

Time not visible on screen #17

Open
Egauss opened this issue Dec 27, 2016 · 7 comments
Open

Time not visible on screen #17

Egauss opened this issue Dec 27, 2016 · 7 comments

Comments

@Egauss
Copy link

Egauss commented Dec 27, 2016

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();
}
}

}

@AndrewMascolo
Copy link
Owner

AndrewMascolo commented Dec 28, 2016 via email

@Egauss
Copy link
Author

Egauss commented Dec 28, 2016

Thanks, for prom reply, i found missing bits....
now i have another small issue: on the end of time i have 00:01 instead 00:00
any idea?

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

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

int led = 13;

int minutesT;
int secondsT;

// 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.printTime(minutesT, secondsT, true);

}

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();
}
}

@AndrewMascolo
Copy link
Owner

AndrewMascolo commented Dec 28, 2016 via email

@Egauss
Copy link
Author

Egauss commented Dec 29, 2016

Thanks its works, and sorry i am just couple days playing with Arduino still lauds to learn.

Do you have experience how to turn on/off leds with this library?

its looks not easy for me.

timer stops at 00:10
first led off (still little bit glowing)
second led on

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

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

int led1 = 13;
int led2 = 10;
int led3 = 9;

int minT;
int secT;

// 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 %
int led1State = LOW;

pinMode(led1, OUTPUT);

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

void loop() {

T.Timer();

digitalWrite(led1, HIGH);

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

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

minT = T.ShowMinutes();
secT = T.ShowSeconds();

display.printTime(minT, secT, true);
}

if (minT == 0 && secT == 10){
T.PauseTimer();
digitalWrite(led1, LOW);
delay(1000);

digitalWrite(led2, HIGH);
if(digitalRead(10) == HIGH)
T.ResumeTimer();

//digitalWrite(led2, HIGH);
//if (minT == 0 && secT == 0) {

//display.clear();
//display.print("DONE");
//display.blink(3000);
// display.off();

}
}

@AndrewMascolo
Copy link
Owner

AndrewMascolo commented Dec 29, 2016 via email

@Egauss
Copy link
Author

Egauss commented Dec 29, 2016

With this code led2, led3 works , but led1 stays ON. just blink one time at the moment when must be OFF. And if i add display.blink on the end led3 have delay coupe sec.

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

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

int led1 = 13;
int led2 = 10;
int led3 = 9;
int led4 = 8;
int butt1 = 7;
int buzz1 = 6;
int led1State = LOW;
int led2State = LOW;
int led3State = LOW;
int led4State = LOW;
int minT;
int secT;

// 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(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(butt1, INPUT);
pinMode(buzz1, OUTPUT);

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

void loop() {

T.Timer();

digitalWrite(led1, led1State);
led1State = true;

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

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

minT = T.ShowMinutes();
secT = T.ShowSeconds();

display.printTime(minT, secT, true);

}

if (minT == 0 && secT == 20){
digitalWrite(led1, led1State);
led1State = false;

digitalWrite(led2, led2State);
led2State = true;
}
if (minT == 0 && secT == 10) {
digitalWrite(led2, led2State);
led2State = false;

digitalWrite(led3, led3State);
led3State = true;
}
if (minT == 0 && secT == 0) {
digitalWrite(led3, led3State);
led3State = false;

T.StopTimer();
display.print("DONE");
//display.blink(3000);
}
}

@AndrewMascolo
Copy link
Owner

AndrewMascolo commented Dec 29, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants