Help needed programming Wordclock

Dear All,

i have all my hardware complete and hooked up. so now the programming begins.
Sadly, i have very little programming skills. so i need a bit of help with this.

I am buidling myself a wordclock. i have an Arduino MEGA with a LED strip connected (WS2812B) and a RTC (DS3231).

Currently i am using the following libraries: NeoPixel (for controlling the LEDS) and DS3231-master for the RTC.

first off i having trouble with setting the date. after that i need my time serially printed so i can use the serial output for my IF construction to light up the correct LEDS compared to the time.

if someone can help out on this that would be very much appreciated!!!!

kind regard,
Tymen

ps. if you need any info please let me know, ill be happy to supply whatever is needed :slight_smile:

It's easy to set the date. Just load the example sketch from the examples folder in the DS3231 library. Run it and set the time/date.

meanduck:
after that i need my time serially printed so i can use the serial output for my IF construction to light up the correct LEDS compared to the time.

You don't need that, because it is absolutely not the way to read the time. The DS3231 library examples demonstrate very well, how to read time from the chip. You should look at them very closely, and it will be almost obvious how it is done.

meanduck:
ps. if you need any info please let me know, ill be happy to supply whatever is needed :slight_smile:

How many pixels wide and high is the display.

How are the strips wired together. If you light up the leds in order how do they process across the matrix?

Have you finalized your work matrix to know what LED's need lighting for what words?

89 LEDS. 9 lines of 10 leds. (but i f'ed up one strip, so i have one line with 9 leds instead of 10.


here you can see how it should look like. (i ve manually programmed the leds for a demo)

is it possible that some one can send me a link of an RTC lib that works for sure.
i get errors straight away when i use a example sketch...

meanduck:
is it possible that some one can send me a link of an RTC lib that works for sure.
i get errors straight away when i use a example sketch...

I suspect you have the best library that is available, in my opinion:

You may have installed the library incorrectly. Please show us the errors.

I just downloaded and installed your lib to be sure.

the error:
Arduino: 1.6.1 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::DS3232RTC()'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::DS3232RTC()'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::dec2bcd(unsigned char)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::bcd2dec(unsigned char)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::writeRTC(unsigned char, unsigned char*, unsigned char)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::writeRTC(unsigned char, unsigned char)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::setAlarm(ALARM_TYPES_t, unsigned char, unsigned char, unsigned char, unsigned char)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::setAlarm(ALARM_TYPES_t, unsigned char, unsigned char, unsigned char)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::read(tmElements_t&)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::get()'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::readRTC(unsigned char, unsigned char*, unsigned char)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::readRTC(unsigned char)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::write(tmElements_t&)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::set(unsigned long)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::alarmInterrupt(unsigned char, bool)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::alarm(unsigned char)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::squareWave(SQWAVE_FREQS_t)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::oscStopped(bool)'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `DS3232RTC::temperature()'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

RTC_new\DS3232RTC.cpp.o: In function `DS3232RTC::DS3232RTC()':

C:\Program Files (x86)\Arduino\libraries\RTC_new/DS3232RTC.cpp:72: multiple definition of `RTC'

DS3232RTC-master\DS3232RTC.cpp.o:C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:72: first defined here

TimeRTC.cpp.o: In function `setup':

C:\Program Files (x86)\Arduino/TimeRTC.ino:15: undefined reference to `setSyncProvider(unsigned long (*)())'

C:\Program Files (x86)\Arduino/TimeRTC.ino:16: undefined reference to `timeStatus()'

TimeRTC.cpp.o: In function `digitalClockDisplay()':

C:\Program Files (x86)\Arduino/TimeRTC.ino:31: undefined reference to `hour()'

C:\Program Files (x86)\Arduino/TimeRTC.ino:32: undefined reference to `minute()'

C:\Program Files (x86)\Arduino/TimeRTC.ino:33: undefined reference to `second()'

C:\Program Files (x86)\Arduino/TimeRTC.ino:35: undefined reference to `day()'

C:\Program Files (x86)\Arduino/TimeRTC.ino:37: undefined reference to `month()'

C:\Program Files (x86)\Arduino/TimeRTC.ino:39: undefined reference to `year()'

DS3232RTC-master\DS3232RTC.cpp.o: In function `DS3232RTC::get()':

C:\Program Files (x86)\Arduino\libraries\DS3232RTC-master/DS3232RTC.cpp:85: undefined reference to `makeTime(tmElements_t&)'

collect2.exe: error: ld returned 1 exit status

Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

You have installed the RTC library incorrectly (or included it incorrectly). It looks as though you may have called functions from the time library without installing it.

It would help if you show us your code. The previous post shows that you are not aware of code tags. Please use them. There is a sticky thread at the top of the forum to show you how to do that.

Still, I am confused about whether you are running the example sketch. The errors you show seem to be from compiling your own code.

Looks like you already have the library installed and the new one you downloaded did not get renamed to remove -master off the end. You probably have a folders called 'DS3232RTC' & 'DS3232RTC-master' in the libraries folder. Delete the one with -master on the end and restart the IDE.
I have attached the library I use and if you run the example and follow the help displayed in the serial monitor you can setup the date/time.

As for programming, I would have separate functions that turn on the LED's for each specific word you have and a main function that determines the time and decides what functions to call to turn the LED's on.

As an example I have attached an image listing some of the function names in my wordclock sketch. All the function names between setBrightness and doTime just turn on the LED's for that particular word when called from the doTime code below.

void doTime(int forced){
    static boolean driftApplied = false;
    static int lastM = -1;

    RTC.readClock();
    int h=RTC.getHours();
    int m=RTC.getMinutes();

    int dows = RTC.getDayOfWeek();
    int mnths = RTC.getMonth();
    int dts = RTC.getDate();
    int hrs = h;
    // ++++++++++ British Summer Time Cycle for Britain ++++++++++
    // In Britain BST only changes on the last Sunday of MARCH and OCTOBER
    // Time goes forward at midnight and goes back at 2AM
    // so days between 25 and 31 are covered by this code
    // dows = DayOfWeek (1=Sunday)
    // mnths = Month
    // dts = Date
    // hrs = Hour
    if (dows == 1 && mnths == 3 || mnths == 10 && hrs >=0 && hrs <=2){
        if (dows == 1 && mnths == 3 && dts >= 25 && dts <=31 && hrs == 0 && BST==0)     // time forward from 00:00 to 01:00 in march if BST status ==0 else don't change time!
        {
            RTC.setHours(1);         //set the hours forward to 01:00                   // when status was ZERO (0) then change time from 00:00 to 01:00 hr
            BST = 1; 
            RTC.setClock();
        }
        if (dows == 1 && mnths == 10 && dts >= 25 && dts <=31 && hrs == 2 && BST==1){   // time backwards from 2:00 to 01:00 in october if BST status ==1 else don't change time!
            RTC.setHours(1);         //set the hours back to 01:00
            BST = 0; 
            RTC.setClock();
        }
    }

    if(!forced){                                        // Are we forcing time update?
        if (m == lastM)                                 // Has Minute value changed since last time?
            return;                                     // No, so return
    }
    lastM = m;                                          // Set last minute to current minute

    // *************************************************
    // *************************************************
    // *************************************************

    if ((m % 15) == 0){
        for (dows=0; dows<10; dows++){
            int x = scrollDates[((dows*2)+0)];
            if (x > 0 && x == mnths){
                x = scrollDates[((dows*2)+1)];
                if (x == dts){
                    scrollMessage((prog_uchar*)pgm_read_word(&(string_table[dows])));
                }
            }
        }
    }


    if ((m % 15) == 5){
        doTemperature();
    }

    // *************************************************
    // *************************************************
    // *************************************************

    for(int intensity=ledIntensity; intensity>=0; intensity--){ 
        delay(fadeDelay);
        lc.setIntensity(0,intensity);
        lc.setIntensity(1,intensity);
    }


    it_s();

    int mod=(m % 5);

    switch (mod){
    case 0:
        break;
    case 1:
        just();
    case 2:
        gone();
        break;
    case 3:
        near();
        m=m+(5-(m % 5));
        break;
    case 4:
        nearly();
        m=m+(5-(m % 5));
        break;
    }

    switch (m){
    case 0:
        oclock();
        break;
    case 1:
    case 2:
    case 3:
    case 4:
        break;
    case 5:
    case 6:
    case 7:
    case 8:
    case 9:
    case 55:
    case 56:
    case 57:
    case 58:
    case 59:
        fiveM();
        break;
    case 10:
    case 11:
    case 12:
    case 13:
    case 14:
    case 50:
    case 51:
    case 52:
    case 53:
    case 54:
        tenM();
        break;
    case 15:
        a();
    case 16:
    case 17:
    case 18:
    case 19:
        quarterM();
        break;
    case 45:
        a();
    case 46:
    case 47:
    case 48:
    case 49:
        quarterM();
        break;
    case 20:
    case 21:
    case 22:
    case 23:
    case 24:
    case 40:
    case 41:
    case 42:
    case 43:
    case 44:
        twentyM();
        break;
    case 25:
    case 26:
    case 27:
    case 28:
    case 29:
    case 35:
    case 36:
    case 37:
    case 38:
    case 39:
        twentyM();
        fiveM();
        break;
    case 30:
    case 31:
    case 32:
    case 33:
    case 34:
        halfM();
        break;
    }

    if ((m >= 5 && m <= 14) || (m >= 20 && m <= 29)) //Minutes Past
    {
        minutes();
        past();
    }
    else if (m >= 15 && m <= 19) //Past
    {
        past();
    }
    else if (m >= 30 && m <= 34) //Half Past
    {
        past();
    }
    else if ((m >= 35 && m <= 44) || (m >= 50 && m <= 59)) //Minutes To
    {
        minutes();
        to();
    }
    else if (m >= 45 && m <= 49) //To
    {
        to();
    }

    if (m>34)
        h++;

    mod = (h % 12);
    switch (mod){
    case 0:
        twelve();
        break;
    case 1:
        one();
        break;
    case 2:
        two();
        break;
    case 3:
        three();
        break;
    case 4:
        four();
        break;
    case 5:
        five();
        break;
    case 6:
        six();
        break;
    case 7:
        seven();
        break;
    case 8:
        eight();
        break;
    case 9:
        nine();
        break;
    case 10:
        ten();
        break;
    case 11:
        eleven();
        break;
    }

    if (h < 12){
        am();
    }
    else {
        pm();
    }

    setBrightness();                                    // Adjust display brightness to suit ambient light
    for(int intensity=0; intensity<(ledIntensity+1); intensity++){ 
        delay(fadeDelay);
        lc.setIntensity(0,intensity);
        lc.setIntensity(1,intensity);
    }

}

RealTimeClockDS3231.zip (9.65 KB)

Yes. The -master rename is part of the installation instructions, I think. I keep a separate folder with master libraries (as downloaded), then copy to the libraries folder as needed. Perhaps that was the authors intention, although probably few people do that. I do it so any changes I make intentionally or unintentionally to the libraries, doesn't leave me without a fresh copy.

I suggest the OP concentrate on getting the time set example sketch working first. It will be easier for us to troubleshoot.

@riva, I hope I'm not bruising anybody's feelings, but the library you linked looks pretty lame to me, compared with Jack's work.

aarg:
@riva, I hope I'm not bruising anybody's feelings, but the library you linked looks pretty lame to me, compared with Jack's work.

Your not bruising my feelings, it's someone else's library I think I altered slightly to suit my needs.
It might not be the dogs nads but it fulfils my needs, and I have been using it for years now in several projects.

ok, guys i found a working lib and i have my time now serially printed, which is nice :).

nog come the tricky part that seemd so easy to me.

i would like an "IF" construction to light up my leds.

so if "hour" == "10" then light up LED's x,x,x,x (ill preset the leds in a void(?)).

could some one show me how to do this in the code that i already have working?

your help is really apreciated!!!!

#include <config.h>
#include <ds3231.h>

#include "Wire.h"
#define DS3231_I2C_ADDRESS 0x68
// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
  return( (val/10*16) + (val%10) );
}
// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return( (val/16*10) + (val%16) );
}
void setup()
{
  Wire.begin();
  Serial.begin(9600);
    
}
void setDS3231time(byte second, byte minute, byte hour)
{
  // sets time and date data to DS3231
  Wire.beginTransmission(DS3231_I2C_ADDRESS);
  Wire.write(0); // set next input to start at the seconds register
  Wire.write(decToBcd(second)); // set seconds
  Wire.write(decToBcd(minute)); // set minutes
  Wire.write(decToBcd(hour)); // set hours
  Wire.endTransmission();
}
void readDS3231time(byte *second,
byte *minute,
byte *hour)
{
  Wire.beginTransmission(DS3231_I2C_ADDRESS);
  Wire.write(0); // set DS3231 register pointer to 00h
  Wire.endTransmission();
  Wire.requestFrom(DS3231_I2C_ADDRESS, 7);
  // request seven bytes of data from DS3231 starting from register 00h
  *second = bcdToDec(Wire.read() & 0x7f);
  *minute = bcdToDec(Wire.read());
  *hour = bcdToDec(Wire.read() & 0x3f);
  }
void displayTime()
{
  byte second, minute, hour;
  // retrieve data from DS3231
  readDS3231time(&second, &minute, &hour);
  // send it to the serial monitor
  Serial.print(hour, DEC);
  // convert the byte variable to a decimal number when displayed
  Serial.print(":");
  if (minute<10)
  {
    Serial.print("0");
  }
  Serial.print(minute, DEC);
  Serial.print(":");
  if (second<10)
  {
    Serial.print("0");
  }
  Serial.print(second, DEC);
  Serial.print(" ");
     
  }

void loop()
{
  displayTime(); // display the real-time clock data on the Serial Monitor,
  delay(1000); // every second
  
  
}

ill preset the leds in a void(?)

They are called functions. void is a datatype.

okay guys, this is what i have now. but eventhough its 21:15 up here, my 22:00 ("TIEN") still lights up...

#include <config.h>
#include <ds3231.h>
#include <Adafruit_NeoPixel.h>


#include "Wire.h"
#define DS3231_I2C_ADDRESS 0x68
// Convert normal decimal numbers to binary coded decimal
#define PIN 6
#define NUM_LEDS 89
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);

int het_is[]= {0,1,2,5,6};
int vijf_min[]= {15,16,17,18};
int tien_min[]= {11,12,13,14};
int kwart[]= {20,21,22,23,24};
int over[]= {26,27,28,29};
int voor[]= {35,36,37,38};
int half[]= {31,32,33,34};
int acht[]= {40,41,42,43};
int twee[]= {43,44,45,46};
int zes[]= {47,48,49};
int drie[]= {56,57,58,59};
int elf[]= {54,55,56};
int tien[]= {50,51,52,53};
int zeven[]= {60,61,62,63,64};
int negen[]= {64,65,66,67,68};
int vier[]= {75,76,77,78};
int twaalf[]= {69,70,71,72,73,74};
int een[]= {79,80,81};
int vijf[]= {82,83,84,85};
int uur[]= {86,87,88};

byte decToBcd(byte val)
{
  return( (val/10*16) + (val%10) );
}
// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return( (val/16*10) + (val%16) );
}
void setup()
{
  Wire.begin();
  Serial.begin(9600);
   
  strip.begin();
  for(int i = 0; i < NUM_LEDS; i++){
  strip.setPixelColor(i,0,0,0);}
  strip.show(); // Initialize all pixels to 'off'
  delay(1000);
}
void setDS3231time(byte second, byte minute, byte hour)
{
  // sets time and date data to DS3231
  Wire.beginTransmission(DS3231_I2C_ADDRESS);
  Wire.write(0); // set next input to start at the seconds register
  Wire.write(decToBcd(second)); // set seconds
  Wire.write(decToBcd(minute)); // set minutes
  Wire.write(decToBcd(hour)); // set hours
  Wire.endTransmission();
}
void readDS3231time(byte *second,
byte *minute,
byte *hour)
{
  Wire.beginTransmission(DS3231_I2C_ADDRESS);
  Wire.write(0); // set DS3231 register pointer to 00h
  Wire.endTransmission();
  Wire.requestFrom(DS3231_I2C_ADDRESS, 7);
  // request seven bytes of data from DS3231 starting from register 00h
  *second = bcdToDec(Wire.read() & 0x7f);
  *minute = bcdToDec(Wire.read());
  *hour = bcdToDec(Wire.read() & 0x3f);
  }
void displayTime()
{
  byte second, minute, hour;
  // retrieve data from DS3231
  readDS3231time(&second, &minute, &hour);
  // send it to the serial monitor
  Serial.print(hour, DEC);
  // convert the byte variable to a decimal number when displayed
  Serial.print(":");
  if (minute<10)
  {
    Serial.print("0");
  }
  Serial.print(minute, DEC);
  Serial.print(":");
  if (second<10)
  {
    Serial.print("0");
  }
  Serial.print(second, DEC);
  Serial.print(" ");
     
  }

void loop()
{
  displayTime(); // display the real-time clock data on the Serial Monitor,
  delay(1000); // every second
 
  {for(int j=0 ; j < 5; j++)  
    {strip.setPixelColor(het_is[j], 128 ,128, 128);
       delay(50);
         strip.show();
    }
  }  
  
  if (byte hour = 22){
    for(int j=0 ; j < 5; j++)  
    {strip.setPixelColor(tien[j], 128 ,128, 128);
       delay(50);
         strip.show();
    }
    }
  
  
}

You are using both a declaration and an assignment in an if statement. That's two mistakes.

  if (byte hour = 20) {

it should be:

  if (hour == 20) {

but you will have to declare "hour" properly somewhere else.

aarg:
You are using both a declaration and an assignment in an if statement. That's two mistakes.

  if (byte hour = 20) {

it should be:

  if (hour == 20) {

but you will have to declare "hour" properly somewhere else.

how can i declare "hour" propperly?

meanduck:
how can i declare "hour" propperly?

Example:

int hour;

Make sure you declare it in the proper scope.

so this is what is got now.... and now i only get "HET IS" to light up.
its 21:45 according to my RTC in the serial monitor. i dont get why this is not working.

although i saw some script with switch case. i do know how this exactly works, but i think it will work better than with my IF construction

#include <config.h>
#include <ds3231.h>
#include <Adafruit_NeoPixel.h>
#include "Wire.h"

#define DS3231_I2C_ADDRESS 0x68
// Convert normal decimal numbers to binary coded decimal
#define PIN 6
//output pin LEDs
#define NUM_LEDS 89
//amount of LEDs
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
//Initiate LEDstrip


//presets for the words
int het_is[]= {0,1,2,5,6};
int vijf_min[]= {15,16,17,18};
int tien_min[]= {11,12,13,14};
int kwart[]= {20,21,22,23,24};
int over[]= {26,27,28,29};
int voor[]= {35,36,37,38};
int half[]= {31,32,33,34};
int acht[]= {40,41,42,43};
int twee[]= {43,44,45,46};
int zes[]= {47,48,49};
int drie[]= {56,57,58,59};
int elf[]= {54,55,56};
int tien[]= {50,51,52,53};
int zeven[]= {60,61,62,63,64};
int negen[]= {64,65,66,67,68};
int vier[]= {75,76,77,78};
int twaalf[]= {69,70,71,72,73,74};
int een[]= {79,80,81};
int vijf[]= {82,83,84,85};
int uur[]= {86,87,88};
int hour;

byte decToBcd(byte val)
{
  return( (val/10*16) + (val%10) );
}
// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return( (val/16*10) + (val%16) );
}
void setup()
{
  Wire.begin();
  Serial.begin(9600);
   
  strip.begin();
  for(int i = 0; i < NUM_LEDS; i++){
  strip.setPixelColor(i,0,0,0);}
  strip.show(); // Initialize all pixels to 'off'
  delay(1000);
}
void setDS3231time(byte second, byte minute, byte hour)
{
  // sets time and date data to DS3231
  Wire.beginTransmission(DS3231_I2C_ADDRESS);
  Wire.write(0); // set next input to start at the seconds register
  Wire.write(decToBcd(second)); // set seconds
  Wire.write(decToBcd(minute)); // set minutes
  Wire.write(decToBcd(hour)); // set hours
  Wire.endTransmission();
}

void readDS3231time(byte *second,
byte *minute,
byte *hour)
{
  Wire.beginTransmission(DS3231_I2C_ADDRESS);
  Wire.write(0); // set DS3231 register pointer to 00h
  Wire.endTransmission();
  Wire.requestFrom(DS3231_I2C_ADDRESS, 7);
  // request seven bytes of data from DS3231 starting from register 00h
  *second = bcdToDec(Wire.read() & 0x7f);
  *minute = bcdToDec(Wire.read());
  *hour = bcdToDec(Wire.read() & 0x3f);
  }
void displayTime()
{
  byte second, minute, hour;
  // retrieve data from DS3231
  readDS3231time(&second, &minute, &hour);
  // send it to the serial monitor
  Serial.print(hour, DEC);
  // convert the byte variable to a decimal number when displayed
  Serial.print(":");
  if (minute<10)
  {
    Serial.print("0");
  }
  Serial.print(minute, DEC);
  Serial.print(":");
  if (second<10)
  {
    Serial.print("0");
  }
  Serial.print(second, DEC);
  Serial.print(" ");
     
  }

void loop()
{
  displayTime(); // display the real-time clock data on the Serial Monitor,
  delay(1000); // every second
 
  {for(int j=0 ; j < 5; j++)  //make every led light up one by one, instead of all at once
    {strip.setPixelColor(het_is[j], 128 ,128, 128); // light up leds in R,G,B
       delay(50);
         strip.show(); 
    }
  }  
  
  if (hour == 21) {
    for(int j=0 ; j < 5; j++)  
    {strip.setPixelColor(negen[j], 128 ,128, 128);
       delay(50);
         strip.show();
    }
    }
    
if (hour == 22) {
    for(int j=0 ; j < 5; j++)  
    {strip.setPixelColor(tien[j], 128 ,128, 128);
       delay(50);
         strip.show();
    }
    }
  
}