[SOLVED]Ds3231 set alarms A1 & A2 once per day in different hours.. every day.


hi i'm trying set alarms a1 , a2 trigger event twice per day... lets @ 10 , 20 hour in 24 hour format.

according found in https://github.com/simonkuang/ds3231




code: [select]

serial.println("a1 fire every minute @ 30 seconds");
   //warning!! possible set stupid values eg 43rd day of month, or 27th hour or 70th minute
   //the values shown alarm 1 & 2 'acceptable' ranges or values
   // there 2 other sketches interupts
   // 1) clock_read_alarm.ino displays settings both alarms
   // 2) clock_test_int.ino simple example of using external interupt
  aday=23; //if adow false aday value 1 31 or if adow true aday value 1 7
  ahour=12; // if a12h=false hour 00 23 or if a12h=true hour 01 12
  aminute=34; // minutes = 00 59
  asecond=30; // seconds= 00 59
  abits=14; //match type values. 0=day/date, 8=hrs/min/sec, 12=min/sec, 14=sec, 15=every sec
  adow=false; //false= match on date, true= match on dow
  a12h=false; //false= use 24hour clock format, true= use 12hour clock format
  apm=false; // if false time 1am 12am, if true time 1pm 12pm
  clock.seta1time(aday, ahour, aminute, asecond, abits, adow, a12h, apm);
  clock.turnoffalarm(1);
  // turn or attention alarm 2.
  /* main difference alarm 2 in alarm mask bits.
   possible fire alarm down minute, i.e. cannot specify
   down second. matches occur @ 00 seconds
   */
  serial.println("a2 fire every minute @ 00 seconds");
  aday=2; //if adow false aday value 1 31 or if adow true aday value 1 7
  ahour=7; //if a12h=false hour 00 23 or if a12h=true hour 01 12
  aminute=25; // minutes 00 59
  abits=112; //match type values. 0=day/date, 64=hrs/min, 96=min, 112=every minute
  adow=false; //false= match on date, true= match on dow
  a12h=false; //false= use 24hour clock format, true= use 12hour clock format
  apm=false; // if false time 1am 12am, if true time 1pm 12pm
  clock.seta2time(aday, ahour, aminute, abits, adow, a12h, apm);
  clock.turnoffalarm(2);


if understand correctly must set following values

for a1

clock.seta1time(aday, ahour, aminute, asecond, abits, adow, a12h, apm);
.....................................00..........10...........00...........00...........8........false...false...false

for a2

clock.seta2time(aday, ahour, aminute, abits, adow, a12h, apm);
......................................00.........20...........00........64.....false....false..false


with above setup a1 trigger alarm @ 10:00 , a2 @ 20:00 ...right ?

i m not sure on how have set first value of each alarm  
aday sould set 00 or else trigger alarm every day of month in defined hour ?

thank in advance.

the above example working !!!

just in case else interested !


Arduino Forum > Using Arduino > Programming Questions > [SOLVED]Ds3231 set alarms A1 & A2 once per day in different hours.. every day.


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code