Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "CountUpDownTimer.h"
- #include "SevenSegmentTM1637.h"
- #include "SevenSegmentExtended.h"
- CountUpDownTimer T(DOWN);
- const byte PIN_CLK = 2; // define CLK pin (any digital pin)
- const byte PIN_DIO = 3; // define DIO pin (any digital pin)
- SevenSegmentExtended display(PIN_CLK, PIN_DIO);
- int tasterstatus=0;
- int taster2status=0;
- int taster = 7;
- int taster2 = 8;
- void setup()
- {
- T.SetTimer(0,0,15);
- T.StartTimer();
- display.begin(); // initializes the display
- display.setBacklight(100); // set the brightness to 100 %
- pinMode(7, INPUT);
- pinMode(8, INPUT);
- delay(1000);
- }
- void loop()
- {
- {T.Timer();
- {taster2status=digitalRead(taster2);
- if(taster2status == HIGH)
- T.StopTimer();
- else
- T.StartTimer();
- }
- if (T.TimeHasChanged() )
- {
- display.printTime(T.ShowMinutes(), T.ShowSeconds(),1);
- {if (T.ShowTotalSeconds()==0)
- Ende();
- }
- {tasterstatus=digitalRead(taster);
- if(tasterstatus == HIGH)
- T.PauseTimer();
- else
- T.ResumeTimer();}
- }
- }
- }
- void Demo(char* str) {
- display.print(str);
- delay(500);
- }
- void Ende() {
- display.printTime(00, 00,0);
- display.blink(100,10);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement