My Arduino keeps running in setup

Hi,
i have an FUTUBA M402SD07G and i want to display how long it takes until the last day of school ends. So i havn't finished that part yet, because as soon as I add the time read function for the DS1307 to get the time, the arduino just resets. I am using an Arduino nano here. (I have an EXTRA Powersuply for the display bc it can draw half an Amp).
Here's the code:
(it is german if you wonder)

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

RTC_DS1307 rtc;
DateTime now;

void setup() {
  Serial.begin(9600);
  delay(2.5 * 1000);

  char clear = 0x1F;
  Serial.print(clear);
  delay(5);
  //char curserOff = 0x14;
  //Serial.print(curserOff);
  delay(5);
  char nM = 0x11;
  Serial.print(nM);

  delay(1 * 1000);
  char Text[] = "       Zeit bis die Schule endet:";
  for(int i = 0; i < 33; ++i) {
    Serial.print(Text[i]);
    delay(3);
  }
  moveSLM();
  char dTSR[] = "             0:000:00:00:00";
  for(int i = 0; i < 27; ++i) {
    Serial.print(dTSR[i]);
    delay(3);
  }
  moveSLM();
}

void loop() {
  now = rtc.now(); 
  //int sec = now.second();
  //what i have done below is just to make sure the loop is working
  Serial.print("|");
  delay(500);
  moveSLM();
  Serial.print("a");
  delay(500);
  moveSLM();
}

void moveSLM() { // this is to set the curser two the bottom left char
  char prep = 0x10;
  char param = 0x28;
  Serial.print(prep);
  delay(100);
  Serial.print(param);
  delay(100);
}

But as soon as i uncomment this line:

  now = rtc.now(); 

It just resets and because of this the setup is looping.
Please somebody help!
Here is the datasheet:

LG

The first step is to check whether an RTC is connected, by running the I2C address scanner program.

If that is successful and returns the correct I2C address, check the RTC function by running one of the examples in the RTC library you have.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.