RTC syntax for time functions
hello,
i working ds3231 rtc module. made own module , using scl , sda pins, because need accurate clock. configured clock , rtc library without bigger problems can see correctly setted time , date via serial interface.
now want use other i/o devices don't know how. example, turn led on @ 20h , turn off @ 6h every day. can't find similar tutorials learn how that, because first time working rtc.
i wonder if should this?
if (now.hour() >= 20) digitalwrite (led, high);
i working ds3231 rtc module. made own module , using scl , sda pins, because need accurate clock. configured clock , rtc library without bigger problems can see correctly setted time , date via serial interface.
code: [select]
void loop () {
datetime = rtc.now();
serial.print(now.day(), dec);
serial.print('/');
serial.print(now.month(), dec);
serial.print('/');
serial.print(now.year(), dec);
serial.print(' ');
serial.print(now.hour(), dec);
serial.print(':');
serial.print(now.minute(), dec);
serial.print(':');
serial.print(now.second(), dec);
serial.println();
now want use other i/o devices don't know how. example, turn led on @ 20h , turn off @ 6h every day. can't find similar tutorials learn how that, because first time working rtc.
i wonder if should this?
if (now.hour() >= 20) digitalwrite (led, high);
code: [select]
if (now.hour() >= 20) digitalwrite (led, high);
else if (now.hour() < 6) digitalwrite (led, high);
else digitalwrite (led, low);
Arduino Forum > Using Arduino > General Electronics > RTC syntax for time functions
arduino
Comments
Post a Comment