JChristensen / DS3232RTC

Arduino Library for Maxim Integrated DS3232 and DS3231 Real-Time Clocks
GNU General Public License v3.0
392 stars 135 forks source link

SQW Alarm with samd21 #64

Closed maxholgasson closed 5 years ago

maxholgasson commented 5 years ago

Hi,

is there a way to use your lib with a Ardunio Zero?

I'm getting a lot of error e.g

/var/folders/v7/k5b0gs_54q91l7p5r85snd_h0000gn/T/arduino_modified_sketch_362800/alarm_ex2.ino: In function 'void loop()':
alarm_ex2:71: error: request for member 'alarm' in '1073746944u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
         RTC.alarm(ALARM_1);    // reset the alarm flag
             ^
exit status 1
JChristensen commented 5 years ago

See https://github.com/JChristensen/DS3232RTC#ds3232rtcbool-initi2c Try instantiating your own DS3232RTC object and name it something other than "RTC".

maxholgasson commented 5 years ago

Thanks!

Do I need to init it with myRTC.begin();after every wake up? I put the mcu to sleep. The RTC is still supplied with power. After waking up do I need to execute myRTC.begin(); again or only once in the setup() and any sleep and wake up doesnt influece it?

JChristensen commented 5 years ago

begin() just initializes the I2C bus so once should do it. I have projects with AVR MCUs that sleep and only one call to begin() is needed. I haven't used the SAMD21; I suppose it might be different in that regard, but I'd be a bit surprised if it were.