Advertisement
Guest User

Untitled

a guest
Apr 30th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. #include "CountUpDownTimer.h"
  2. #include "SevenSegmentTM1637.h"
  3. #include "SevenSegmentExtended.h"
  4.  
  5. CountUpDownTimer T(DOWN);
  6. const byte PIN_CLK = 2;   // define CLK pin (any digital pin)
  7. const byte PIN_DIO = 3;   // define DIO pin (any digital pin)
  8. SevenSegmentExtended   display(PIN_CLK, PIN_DIO);
  9. int tasterstatus=0;
  10. int taster2status=0;
  11. int taster = 7;
  12. int taster2 = 8;
  13.  
  14.  
  15. void setup()
  16. {
  17.  
  18.   T.SetTimer(0,0,15);
  19.   T.StartTimer();
  20.   display.begin();            // initializes the display
  21.   display.setBacklight(100);  // set the brightness to 100 %
  22.   pinMode(7, INPUT);
  23.   pinMode(8, INPUT);
  24.   delay(1000);
  25. }
  26.  
  27. void loop()
  28. {
  29.   {T.Timer();
  30.   {taster2status=digitalRead(taster2);
  31.   if(taster2status == HIGH)
  32.   T.StopTimer();
  33.   else
  34.   T.StartTimer();
  35.  }  
  36.     if (T.TimeHasChanged() )
  37.    {
  38.     display.printTime(T.ShowMinutes(), T.ShowSeconds(),1);
  39.       {if (T.ShowTotalSeconds()==0)
  40.   Ende();
  41.   }
  42.  
  43.    
  44.    {tasterstatus=digitalRead(taster);
  45.     if(tasterstatus == HIGH)
  46.    T.PauseTimer();
  47.   else
  48.     T.ResumeTimer();}
  49.    }
  50.    
  51. }
  52. }
  53.  
  54. void Demo(char* str) {
  55.   display.print(str);
  56.   delay(500);
  57. }
  58.  
  59. void Ende() {
  60.   display.printTime(00, 00,0);
  61.   display.blink(100,10);
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement