Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #include <DS3231_Simple.h>
  2.  
  3. DS3231_Simple Clock;
  4. DateTime MyTimestamp;
  5. void setup() {
  6.  
  7.  
  8. Serial.begin(9600);
  9. Serial.println();
  10.  
  11. Clock.begin();
  12.  
  13. Clock.disableAlarms();
  14.  
  15.  
  16. MyTimestamp = Clock.read();
  17.  
  18. MyTimestamp.Hour= 10; //Version die funktioniert
  19. MyTimestamp.Minute = 37;
  20.  
  21. //MyTimestamp.Second=1; Version Funktioniert
  22.  
  23. Clock.setAlarm(MyTimestamp, DS3231_Simple::ALARM_MATCH_MINUTE_HOUR);
  24. //Clock.setAlarm(MyTimestamp, DS3231_Simple::ALARM_MATCH_SECOND); Version nur mit Sekunden
  25.  
  26. Serial.println("Waiting for alarms...");
  27. }
  28.  
  29. void loop()
  30. {
  31.  
  32. MyTimestamp.Hour = 10; //Version die nicht funktioniert
  33. MyTimestamp.Minute =37;
  34.  
  35. // MyTimestamp.Second = 1; Version funktioniert ebenfalls
  36.  
  37. uint8_t AlarmsFired = Clock.checkAlarms();
  38.  
  39.  
  40. if(AlarmsFired &2)
  41. {
  42. Clock.printTo(Serial);Serial.println(": Alarm has fired!");
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement