DS1307 RTC library

ok so i am making a light for my fish tank and i will be using the DS1307. i just finished planing the hardware side of my project and now i need an easy to use library for the DS1307 RTC.
i want to make it turn on leds at 7:30am and turn it off at 8:30pm
i looked at the library from here, but i can't find much documentation about it DS1307 RTC tutorial

P.S. i have no code as of yet

There is a library linked to on that site, with examples. Surely they are sufficient for you to learn how to set the time and get the time.

When you have the time, you can examine it, to see if “now” matches the time you should do something (turn LED on or turn LED off). If it is, do it.

tigerbomb8:
i looked at the library from here, but i can't find much documentation about it DS1307 RTC tutorial

You really shouldn't need much in the way of documentation. The examples provided with the library and on Ada's tutorial page tell you how to set the time and read the time. That's all you need to do.

Don't overcomplicate your design by trying to set alarms or anything. Just write your code to check what time it is and if you should be turning lights on or off.

i did play around with the example code that only use the arduino but i could not work out how to make the minutes into an integer
i tried

// Date and time functions using just software, based on millis() & timer

#include <Wire.h>
#include "RTClib.h"

int minval;

RTC_Millis RTC;

void setup () {
    Serial.begin(57600);
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.begin(DateTime(__DATE__, __TIME__));
}

void loop () {
    DateTime now = RTC.now();
    
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    
//i wrote everything below this

    int minval = (now.minute(), DEC);
    Serial.println(minval);
    Serial.println();
   
    delay(1000);
}

and then printed it out in it keep coming up with the number 10

    Serial.print(now.minute(), DEC);

This tells the print() method of the Serial object to print an integer value in base 10 format.

    int minval = (now.minute(), DEC);

No clue what the heck this is actually doing, but, I'm guessing that you don't either. It is certainly wrong. Get rid of the parentheses and the , DEC bit.

" int minval = (now.minute(), DEC);"

This doesn’t make sense. The argument “, DEC” tells Serial.println what format to print the number as (DECimal, HEXadecimal, OCTal, etc).

Should be:
int minval = now.minute();

ok now it prints the correct value,
thanks for your help :slight_smile:
i will get back to you if i run into another roadblock