-
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
Time not visible on screen #17
Comments
I am unfamiliar with your display library, check to see if it has an up date function. If it does then set the time and call it. Once you get that working try some debugging.
I don't have any of my equipment to run any tests, so I can only rely on your tests to move further.
…Sent from my iPhone
On Dec 27, 2016, at 6:45 PM, Egauss ***@***.***> wrote:
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();
}
}
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks, for prom reply, i found missing bits.... #include <SevenSegmentTM1637.h> #include <CountUpDownTimer.h> int led = 13; int minutesT; // run setup code pinMode(led, OUTPUT); display.print("...."); void loop() { digitalWrite(led, HIGH); if (T.TimeHasChanged() ) // this prevents the time from being constantly shown. } Serial.print(T.ShowMinutes()); minutesT = T.ShowMinutes(); if (minutesT == 0 && secondsT == 0) { |
Try changing this part here
if (T.TimeHasChanged() ) // this prevents the time from being constantly shown.
{
Serial.print(T.ShowMinutes());
Serial.print(":");
Serial.print(T.ShowSeconds());
minutesT = T.ShowMinutes();
secondsT = T.ShowSeconds();
// once the minutes and seconds are set, you display them
display.printTime(minutesT, secondsT, true);
}
Sent from my iPhone
… On Dec 27, 2016, at 10:56 PM, Egauss ***@***.***> wrote:
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();
|
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 #include <SevenSegmentTM1637.h> #include <CountUpDownTimer.h> int led1 = 13; int minT; // run setup code pinMode(led1, OUTPUT); display.print("...."); void loop() { T.Timer(); digitalWrite(led1, HIGH); if (T.TimeHasChanged() ) // this prevents the time from being constantly shown. Serial.print(T.ShowMinutes()); minT = T.ShowMinutes(); display.printTime(minT, secT, true); if (minT == 0 && secT == 10){ digitalWrite(led2, HIGH); //digitalWrite(led2, HIGH); //display.clear(); } |
Led1 is constantly being turned on and off, which is why it is glowing. To solve this just use one variable, Led1State.
Set it to true when you start the timer and make sure you use it in digitalwrite(led1, Led1State);
This way the led is always looking at that variable instead of hard coding true or false.
Now according to your code, led2, when it is high is set to resume the timer.
Is this what you want?
When does it turn off?
Also you are telling the code to pause the timer at seconds = 10 and immediately resuming it.
digitalWrite(led2, HIGH) and digitalRead(10) are both looking at the same pin. So one is setting pin 10 High and the other is always reading pin 10 is high.
Maybe add more If statements to turn off led2
…Sent from my iPhone
On Dec 28, 2016, at 8:05 PM, Egauss ***@***.***> wrote:
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();
}
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
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 <CountUpDownTimer.h> int led1 = 13; // run setup code pinMode(led1, OUTPUT); display.print("...."); void loop() { T.Timer(); digitalWrite(led1, led1State); if (T.TimeHasChanged() ) // this prevents the time from being constantly shown. Serial.print(T.ShowMinutes()); minT = T.ShowMinutes(); display.printTime(minT, secT, true); } if (minT == 0 && secT == 20){ digitalWrite(led2, led2State); digitalWrite(led3, led3State); T.StopTimer(); |
Your code is backwards. You need to set the variable first THEN use it in the digitalWrite.
…Sent from my iPhone
On Dec 28, 2016, at 11:30 PM, Egauss ***@***.***> wrote:
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);
}
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
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();
}
}
}
The text was updated successfully, but these errors were encountered: