Why doesn't the LED strip in the clock light up?

Hello,

For some reason, my program doesn't make the LED clock work properly. I know that the problem is either in the breadboard or the program itself, since with the other program and different circuit everything works well. Everything is fine with the power supply and the connections between the peices of the LED strip are done correctly...

UPD The program doesn’t work in such a way that the LED strip is not lighted up, hence is not working as a clock.
The program which lights up the LEDs separately works perfectly well, and the program which makes the clock print the time into the serial monitor also works…
The code is also written in Arduino

I have also already set up the clock..

Can you, please, help me?

These are the connections on the breadboard:

The link to the codeI use:
https://codeshare.io/vwlVQk

Hello paulinesidiropoulou
Post your sketch, well formated, with comments and in so called code tags "</>" and schematic to see how we can help.
Have a nice day and enjoy coding in C++.

The code is in Arduino, are the comments on it enough?

Post the code in code tags, please.

Are you using I2C pullup resistors?

Did you read a forum rules?
Is not in a traditions of the forum to download the codes from the externals links.
If you looking to help, please insert your code in the message using the code tags.

#include <DS3231.h>
DS3231 rtc(SDA, SCL);

#include <FastLED.h>
#include <Wire.h> 
#include <DS1307RTC.h>


#define NUM_LEDS 172 // 6*7*4 +2+2  Number of LED controlled
#define COLOR_ORDER GRB  // Define color order for your strip
#define DATA_PIN 12 // Data pin for led comunication D9

CRGB leds[NUM_LEDS]; // Define LEDs strip

const byte digits[10][42] PROGMEM = 
                      {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},   // Digit 0
                       {0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1},   // Digit 1
                       {1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1},   // Digit 2
                       {0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1},   // Digit 3
                       {0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1},   // Digit 4
                       {0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0},   // Digit 5
                       {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0},   // Digit 6
                       {0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1},   // Digit 7
                       {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},   // Digit 8
                       {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0}};  // Digit 9
                       
int last_digit = 0;
int ledColor = CRGB::White; // Color used (in hex)

void setup(){ 
  //Make the clock work and set its initial parameters
  Serial.begin(9600); 
  rtc.begin();
  //rtc.setTime(19, 48, 50);     // Set the time to 12:00:00 (24hr format)
  //rtc.setDate(3, 6, 2017);   // Set the date to the current date

  Wire.begin();
  FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
  LEDS.setBrightness(200); // Set initial brightness
} 

int GetTime(){
  tmElements_t Now;
  RTC.read(Now);
  //time_t Now = RTC.Now();// Getting the current Time and storing it into a DateTime object 
  int hour=Now.Hour;
  //Serial.println(hour); //ia going to show the hour set to the clock by the other
  //Serial.println("--");
  int minute=Now.Minute;
  //Serial.println(minute); //ia going to show the hour set to the clock by the other
  //Serial.println("--");

  return (hour*100+minute);
  };

// Convert time to array needed for display 
void TimeToArray(){
  int Now = GetTime();  // Get time
  //Serial.print("Time is: ");
  //Serial.println(Now);
  //delay(1000);
  
  int cursor = 271; // last led number
  
  //dots of the clock
  leds[83]=ledColor;
  leds[84]=ledColor;
  leds[85]=ledColor;
  leds[86]=ledColor;
    
  for(int i=1;i<=4;i++){
    int digit = Now % 10; // get the last digit of the time starting from the last digit of the minutes

    if (i==1){
    //  Serial.print("the last digit of the minures is : ");Serial.print(digit);Serial.print(" ");

      cursor = 129;
      
      for(int k=0; k<=41;k++){ 
        // Serial.print(digits[digit][k]);
        if (digits[digit][k]== 1){leds[cursor]=ledColor;}
         else if (digits[digit][k]==0){leds[cursor]=0x000000;};
         cursor ++;
        };
      // Serial.println();
      }

    else if (i==2){
      // Serial.print("The first digit of the minutes is : ");Serial.print(digit);Serial.print(" ");

      cursor =87;
      
      for(int k=0; k<=41;k++){ 
        // Serial.print(digits[digit][k]);
        if (digits[digit][k]== 1){leds[cursor]=ledColor;}
         else if (digits[digit][k]==0){leds[cursor]=0x000000;};
         cursor ++;
        };
      // Serial.println();
      }

     else if (i==3){
      // Serial.print("The last digit of the hours is : ");Serial.print(digit);Serial.print(" ");
      cursor =41;
      for(int k=0; k<=41;k++){ 
        // Serial.print(digits[digit][k]);
        if (digits[digit][k]== 1){leds[cursor]=ledColor;}
         else if (digits[digit][k]==0){leds[cursor]=0x000000;};
         cursor ++;
        };
      // Serial.println();
      }
      
    else if (i==4){
      // Serial.print("The first digit of the hours is : ");Serial.print(digit);Serial.print(" ");
      cursor =0;
      if(digit !=0){
         for(int k=0; k<=41;k++){ 
        // Serial.print(digits[digit][k]);
        if (digits[digit][k]== 1){leds[cursor]=ledColor;}
         else if (digits[digit][k]==0){leds[cursor]=0x000000;};
         cursor ++;
        };
    }
    }
     Now /= 10;
  }; 
};
  
void loop()  // Main loop
{
  GetTime(); // get the time 
  TimeToArray(); // Get leds array with required configuration
  FastLED.show(); // Display leds array
  delay(1000);
}

Here is the code

I have used resistors between the Arduino nano and the LED strip

Thank you for trying to help!

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