Non riesco a venirne a capo

ecco lo sketch, diviso in due parti sennò non mi entrava, abbiate pazienza e... grazie davvero a tutti

/*
/*
 * TimeRTC.pde
 * example code illustrating Time library with Real Time Clock.
 * 
 */
#include <LiquidCrystal.h>
#include <Time.h>  
#include <Wire.h>  
#include <DS1307RTC.h>  // a basic DS1307 library that returns time as a time_t
LiquidCrystal LCD(12,11,5,4,3,2);



void setup()  {
  
 LCD.begin (16,2);
 
  setSyncProvider(RTC.get);   // the function to get the time from the RTC
    
}

void loop()
{
  LCD.setCursor(0,0);
   digitalClockDisplay();  
   delay(1000);
  
}
void digitalClockDisplay(){
  // digital clock display of the time
  LCD.print(hour());
  printDigits(minute());
  LCD.setCursor(5,0);
  printDigits(second());
  LCD.print(" ");
  }

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  
  LCD.print(":");
  if(digits < 10)
    LCD.print('0');
  LCD.print(digits);
  

 
 
   int ledw1=9;//pin linea led bianchi e rb posteriore
   int ledw2=10;//pin linea led bianchi e rb anteriore
   int leduv=6;//pin linea led rossi, verdi, uv
   signed int dim;
   signed int ora;
   signed int oras;
   int moonlight=7;//pin led lunari
   unsigned long time=+(hour()*60*60 + minute()*60 + second());//orario hr,min,sec ridotto in secondi
   pinMode (ledw1,OUTPUT);
   pinMode (ledw2, OUTPUT);
   pinMode (leduv, OUTPUT);
   pinMode (moonlight,OUTPUT);  
   dim=255/18;//aumento intensità per ogni step
   ora=45000;//12:30 ora accensione in millisecondi(ore*3600 minuti*60 secondi*1)*1000
   oras=81900;//23:15 ora spegnimento in millisecondi(ore*3600 minuti*60 secondi*1)*1000
   signed int x=150;//intervallo in millisecondi tra un fade e un altro 

/*impostazione per l'accensione deiled lunari*/
  
  
  if (time > oras+x*2 or time<ora+x){
    digitalWrite (moonlight, HIGH);
  }
  if (time < oras+x*2 && time>ora+x){
  digitalWrite (moonlight, LOW);}
  delay(10);
 /*inizio della fase 'Alba' e aumento graduale dell'intensità dell'illuminazione*/ 
    
    if ( time >= ora&&time <ora+x)
  {
  analogWrite (ledw1,dim*18);
  analogWrite (ledw2,dim*18);
  analogWrite (leduv, dim*16);
  LCD.setCursor(0,1);
  LCD.print ("Alba 0%");
  delay(10);
}

 if (time >= ora+x&&time<ora+x*2)
  {
  analogWrite (ledw1,dim*18);
  analogWrite (ledw2,dim*18);
  analogWrite (leduv, dim*14);
  LCD.setCursor(0,1);
  LCD.print ("Alba 6%");
  delay(10);
}

if (time >= ora+x*2&&time < ora+x*3)
  {
  analogWrite (ledw1,dim*18);
  analogWrite (ledw2,dim*16);
  analogWrite (leduv, dim*14);
  LCD.setCursor(0,1);
  LCD.print ("Alba 12%");
  delay(10);
}

if (time >= ora+x*3&&time < ora+x*4)
  {
  analogWrite (ledw1,dim*17);
  analogWrite (ledw2,dim*15);
  analogWrite (leduv, dim*13);
  LCD.setCursor(0,1);
  LCD.print ("Alba 18%");
  delay(10);
}

if (time >=ora+x*4&&time < ora+x*5)
  {
  analogWrite (ledw1,dim*16);
  analogWrite (ledw2,dim*14);
  analogWrite (leduv, dim*12);
  LCD.setCursor(0,1);
  LCD.print ("Alba 24%");
  delay(10);
}

if (time >= ora+x*5&&time<ora+x*6)
  {
  analogWrite (ledw1,dim*15);
  analogWrite (ledw2,dim*13);
  analogWrite (leduv, dim*11);
  LCD.setCursor(0,1);
  LCD.print ("Alba 30%");
  delay(10);
}
if (time >= ora+x*6&&time<ora+x*7)
  {
  analogWrite (ledw1,dim*14);
  analogWrite (ledw2,dim*12);
  analogWrite (leduv, dim*10);
  LCD.setCursor(0,1);
  LCD.print ("Alba 36%");
  delay(10);
}

if (time >= ora+x*7&&time<ora+x*8)
  {
  analogWrite (ledw1,dim*13);
  analogWrite (ledw2,dim*11);
  analogWrite (leduv, dim*9);
  LCD.setCursor(0,1);
  LCD.print ("Alba 42%");
  delay(10);
}

if (time >= ora+x*8&&time<ora+x*9)
  {
  analogWrite (ledw1,dim*12);
  analogWrite (ledw2,dim*10);
  analogWrite (leduv, dim*8);
  LCD.setCursor(0,1);
  LCD.print ("Alba 48%");
  delay(10);
}

if (time >= ora+x*9&&time<ora+x*10)
  {
  analogWrite (ledw1,dim*11);
  analogWrite (ledw2,dim*9);
  analogWrite (leduv, dim*7);
  LCD.setCursor(0,1);
  LCD.print ("Alba 54%");
  delay(10);
}
if (time >= ora+x*10 && time<ora+x*11)
  {
  analogWrite (ledw1,dim*10);
  analogWrite (ledw2,dim*8);
  analogWrite (leduv, dim*6);
  LCD.setCursor(0,1);
  LCD.print ("Alba 60%");
  delay(10);
}
if (time >= ora+x*11 && time<ora+x*12)
  {
  analogWrite (ledw1,dim*9);
  analogWrite (ledw2,dim*7);
  analogWrite (leduv, dim*5);
  LCD.setCursor(0,1);
  LCD.print ("Alba 66%");
  delay(10);
}

if (time >= ora+x*12 && time<ora+x*13)
  {
  analogWrite (ledw1,dim*8);
  analogWrite (ledw2,dim*6);
  analogWrite (leduv, dim*4);
  LCD.setCursor(0,1);
  LCD.print ("Alba 72%");
  delay(10);
}
if (time >= ora+x*13 && time<ora+x*14)
  {
  analogWrite (ledw1,dim*7);
  analogWrite (ledw2,dim*5);
  analogWrite (leduv, dim*4);
  LCD.setCursor(0,1);
  LCD.print ("Alba 78%");
  delay(10);
}
if (time >=ora+x*14 && time<ora+x*15)
  {
  analogWrite (ledw1,dim*6);
  analogWrite (ledw2,dim*4);
  analogWrite (leduv, dim*4);
  LCD.setCursor(0,1);
  LCD.print ("Alba 84%");
  delay(10);
}

if (time >=ora+x*15 && time<ora+x*16)
  {
  analogWrite (ledw1,dim*5);
  analogWrite (ledw2,dim*4);
  analogWrite (leduv, dim*4);
  LCD.setCursor(0,1);
  LCD.print ("Alba 90%");
  delay(10);
}
/*fase intermedia 'Giorno' nella quale l'illuminazione viene tenuta al massimo dell'intensità impostata e che va dalla fine dell'alba all'inizio della fase di decremento dell'illuminazione 'Tramonto' */
if (time >ora+x*16 && time <oras+x)
  {
  analogWrite (ledw1,dim*4);
  analogWrite (ledw2,dim*4);
  analogWrite (leduv, dim*4);
  LCD.setCursor(0,1);
  LCD.print ("Giorno");
  delay(10);
}