Advertisement
Benny1994

Untitled

May 26th, 2021
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <RTCZero.h>
  2.  
  3. RTCZero rtc;
  4. const byte seconds = 0;
  5. const byte minutes = 00;
  6. const byte hours = 00;
  7.  
  8. int value = 0;
  9. void setup()
  10. {
  11.   Serial.begin(9600);
  12.   rtc.begin(); // initialize RTC
  13.   rtc.setMinutes(minutes);
  14.   rtc.setAlarmSeconds(120);
  15.   rtc.enableAlarm(rtc.MATCH_SS);
  16.   rtc.attachInterrupt(alarmMatch);
  17.  
  18.   Serial.println("start ");
  19. }
  20.  
  21. void loop()
  22. {
  23.  
  24.   if (value == 1)
  25.   {
  26.     Serial.println("2 minuten gedaan ");
  27.     value = 0;
  28.   }
  29. }
  30. void alarmMatch()
  31. {
  32.   value = 1;
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement