RTC timer: set pin to '1' at 23:00 and release it to '0' at 07:00 next morning

Hi guys!

DS3231 + ‘Nano’

Now I’ve got a pair of sketches: one of them is a kind of primitive relay thermostat that gets data from HTU21, and the other can send to a Monitor current date, time and temperature from RTC module.

I’d like to switch on the thermostat at specific time in the evening, everyday, and switch it off at specific time the next morning, everyday. DS3231 does contain its own thermosensor, so there’s no need of HTU21 in this project. But I can’t put these two sketches together in order to get a kind of single compiled working version that can do what I described above. Would you please to help me?

HTU21D_Alex.ino (15.2 KB)

ds3231.ino (2.07 KB)

Show us your attempt at combining the two sketches.

In order to combine sketches, the basic idea is to understand what every line in the setup() and loop() functions of each sketch does and why each is necessary. Note that if you copy/pasted code, you may discover some junk in the process.

With that understanding, it is straightforward to choose which lines you need for the combined product, while making sure you do not introduce conflicts.