I need help with count up timer code!!

So i have this code and I dont have lcd yet but when I try to print it on serial monitor it keeps printing numbers into infinity in one row. Can somebody help?

#include<print.h>
#include <LiquidCrystal.h>
#include <TimeLib.h>
#include <SPI.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <Adafruit_LEDBackpack.h>
#include <Adafruit_GFX.h>
#include <RTClib.h>

#define BACKLIGHT_PIN     13

RTC_DS1307 rtc = RTC_DS1307();

LiquidCrystal_I2C lcd(0x38); //set LCD I2C address

const uint8_t charBitmap[][8] = 
{
   { 0xc, 0x12, 0x12, 0xc, 0, 0, 0, 0 },
   { 0x6, 0x9, 0x9, 0x6, 0, 0, 0, 0 },
   { 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0, 0x0 },
   { 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0, 0x0 },
   { 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0x0 },
   { 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0x0 },
   { 0x0, 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0x0 },
   { 0x0, 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0x0 }
   
};


int hours = 0;
int minutes = 0;
int seconds = 0;

int weeks ;

unsigned long days ; 

unsigned long previousMillis = 0;        // will store last millis event time 
unsigned long sensorpreviousMillis = 0;        // will store last millis event time 
unsigned long fiveMinuteInterval = 300000;           // interval at which to use event time (milliseconds)
unsigned long postDaysInterval = 7200000 ; //seconds in a day 86400000
unsigned long theDateWeGotTogether = 1470243600   ;  //in unixtime



void setup() {                
  Serial.begin(115200); 
  int charBitmapSize = (sizeof(charBitmap ) / sizeof (charBitmap[0]));

  pinMode ( BACKLIGHT_PIN, OUTPUT );
  digitalWrite ( BACKLIGHT_PIN, HIGH );
  
  rtc.begin();
  lcd.begin(16,2);

  for ( int i = 0; i < charBitmapSize; i++ )
   {
      lcd.createChar ( i, (uint8_t *)charBitmap[i] );
   }

    
 bool setClockTime = !rtc.isrunning();
 if (setClockTime) {
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
  
}

void loop() 
{
//  DateTime now = rtc.now(); 
  days = ((now() - theDateWeGotTogether) / 86400); //86400 is the number of seconds in a day 
  unsigned long int currentMillis = millis();
  ShowDaysReading();
  time_t t = now();

  
 
  if(currentMillis - sensorpreviousMillis > fiveMinuteInterval) 
  {
    // save the last time you performed event
    sensorpreviousMillis = currentMillis;   
    DateTime now = rtc.now();
  }
}

void ShowDaysReading()
{  
  days = ((now() - theDateWeGotTogether) / 86400); //86400 number of seconds in a day
  weeks = ((now() - theDateWeGotTogether) / (86400* 7) ); //86400 number of seconds in a day

  lcd.print(days);
  Serial.print(days);  
 
}

Sorry, I tried to compile your program, but there are SO many different libraries that I am missing at least one.

Apparently you have not tried any debugging by printing the intermediate values. Try "Serial.write( name of what is potentially causing problem);. Perhaps doing the same for each variable in your program. This is called "debugging" and you need to learn a bit about it.

Paul

it keeps printing numbers into infinity in one row.

No surprise as you are not printing a newline character.

Try

 Serial.println(days);

Hey Paul_KD7HB thanks for tip, I am still new to this. UKHeliBob thanks for advice, i did it but i think thats not resukt i was expecting. Can I ask someone to try and compile this code? All libraries are listed in #included.

Why do you include ALL those libraries? Are they really being used? Have you tried debugging using Serial.print, etc?

Paul

My bad, I can compile it with just these libraries

#include <TimeLib.h>
#include <LiquidCrystal_I2C.h>
#include <RTClib.h>

UKHeliBob thanks for advice, i did it but i think thats not resukt i was expecting

What did you get ? What were you expecting ?

I want to print days from specific days to lcd (which idont have yet) and to serial monitor. I get “32693” number printing every milisecond.