Flickering LEDs

Hi there

Im new to Arduino…
I seem to have a problem with my LED’S flickering after the cycle runs.
code ends at 1600 but after the loop the LED’S flicker constantly. How can i stop it.

Code below.

#include <OneWire.h>
#include <LCDI2C.h>
#include <WProgram.h>
#include <Wire.h>
#include <DS1307RTC.h>
#include <LiquidCrystal.h>
#include <Time.h>
#include <TimeAlarms.h>
#include

//************************************ void setup ************************************

void setup()
{
Serial.begin(9600);
setSyncProvider(RTC.get); // the function to get the time from the RTC
}
//************************************ void loop ************************************

void loop(){

//****************Day Lights *******************************************************************************

if(hour()>=8) analogWrite(11, 26);
if(hour()>=9) analogWrite(11, 52);
if(hour()>=10) analogWrite(11, 78);
if(hour()>=11) analogWrite(11, 104);
if(hour()>=12) analogWrite(11, 130);
if(hour()>=14) analogWrite(11, 104);
if(hour()>=15) analogWrite(11, 78);
if(hour()>=16) analogWrite(11, 52);
if(hour()>=17) analogWrite(11, 26);
if(hour()>=18) analogWrite(11, 0);

//****************Moon Lights *******************************************************************************

if(hour()>=7) analogWrite(3, 127);
if(hour()>=19) analogWrite(3, 65);
if(hour()>=20) analogWrite(3, 0);

//Display Time******************************************************************************************

// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.println();
}

void printDigits(int digits)
{
Serial.print(":");
if(digits < 10)
Serial.print(‘0’);
Serial.print(digits);

}

 if(hour()>=8)  analogWrite(11, 26);
  if(hour()>=9)  analogWrite(11, 52);
  if(hour()>=10) analogWrite(11, 78);
  if(hour()>=11) analogWrite(11, 104);
  if(hour()>=12) analogWrite(11, 130);
  if(hour()>=14) analogWrite(11, 104);
  if(hour()>=15) analogWrite(11, 78);
  if(hour()>=16) analogWrite(11, 52);
  if(hour()>=17) analogWrite(11, 26);
  if(hour()>=18) analogWrite(11, 0);

Note that 20 is both >=18 and >=8, 9, 10,… All of your analogWrite() calls get run every time through loop(). That is why your LED on Pin 11 flickers.

Try something like this:

  if(hour() < 8)  analogWrite(11, 0);
  if(hour() == 8)  analogWrite(11, 26);
  if(hour() == 9)  analogWrite(11, 52);
  if(hour() == 10) analogWrite(11, 78);
  if(hour() == 11) analogWrite(11, 104);
  if(hour() >= 12 && <= 13) analogWrite(11, 130);
  if(hour() == 14) analogWrite(11, 104);
  if(hour() == 15) analogWrite(11, 78);
  if(hour() == 16) analogWrite(11, 52);
  if(hour() == 17) analogWrite(11, 26);
  if(hour() >= 18) analogWrite(11, 0);

Hi there

Thank you for the help. The flickering seems to have stopped

Thanks again