The problem with this sketch is that there is no RTC, so i bought a separate unit and simply want to add the RTClib DS1307 code. Seems simple enough, but when i see the output, all i get is -1 for the date and time.
Have you run the examples that come with the RTC library, without the weather shield attached? Do they work?
The weather station shield also uses I2C to communicate with the Arduino. There may be conflicts with addresses or with the weather shield device’s use of the I2C bus.
Try searching for, and running the I2C scanner, just to make sure that all the hardware is connected correctly, and using the right addresses.
Also, the data collects every second. I’d like to send data out every 5 minutes. But for the life of me i cant see in the code where it determines the output data frequency.
Omitting the extraneous stuff that loop is doing (like collecting data from the sensors), it looks like this:
//Keep track of which minute it is
if(millis() - lastSecond >= 1000)
digitalWrite(STAT1, HIGH); //Blink stat LED
lastSecond += 1000;
//Report all readings every second
digitalWrite(STAT1, LOW); //Turn off stat LED
It’s hard to understand why you can’t see how often data is output.
It’s hard to understand what that stupid delay() is for. Who cares that loop() iterates 42 bazillion times before it is time to do something, vs 0.42 bazillion times?