set 2 Bytes together

Hi all

I currently build a word Clock, and i have a question to you:

I declare every letter in a byte. How can i combinen two bytes?

For a example if i have

byte nlc[32] = {
  B00000000, B00000000,  //1    
  B00000000, B00000000,  //2
  B00000000, B00000000,  //3     
  B00000000, B00000000,  //4
  B00000000, B00000000,  //5      
  B00000000, B00000000, //6
  B00000000, B00000000, //7      
  B00000000, B00000000, //8
  B00000000, B00000000, //9      
  B00000000, B00000000, //10
  B00000000, B00000000, //11      
  B00100000, B00000000, //12
  B00000000, B00000000, //13     
  B00000000, B00000000, //14
  B00000000, B00000000, //15     
  B00000000, B00000000, //16
      
};
byte tld[32] = {
  B00000000, B00000000,  //1    
  B00000000, B00000000,  //2
  B00000000, B00000000,  //3     
  B00000000, B00000000,  //4
  B00000000, B00000000,  //5      
  B00000000, B00000000, //6
  B00000000, B00000000, //7      
  B00000000, B00000000, //8
  B00000000, B00000000, //9      
  B00000000, B00000000, //10
  B00000000, B00000000, //11      
  B00010000, B00000000, //12
  B00000000, B00000000, //13     
  B00000000, B00000000, //14
  B00000000, B00000000, //15     
  B00000000, B00000000, //16

An I wannna make one byte out of these two

Did i have an && funktion or a || to use?

Thanks a lot

You could store them as word rather than byte, like this:

word nlc[32] = {
  0B0000000000000000,  //1    
  0B0000000000000000,  //2
  0B0000000000000000,  //3     
  0B0000000000000000,  //4
  0B0000000000000000,  //5      
  0B0000000000000000, //6
  0B0000000000000000, //7      
  0B0000000000000000, //8
  0B0000000000000000, //9      
  0B0000000000000000, //10
  0B0000000000000000, //11      
  0B0010000000000000, //12
  0B0000000000000000, //13     
  0B0000000000000000, //14
  0B0000000000000000, //15     
  0B0000000000000000, //16
      
};
word tld[32] = {
  0B0000000000000000,  //1    
  0B0000000000000000,  //2
  0B0000000000000000,  //3     
  0B0000000000000000,  //4
  0B0000000000000000,  //5      
  0B0000000000000000, //6
  0B0000000000000000, //7      
  0B0000000000000000, //8
  0B0000000000000000, //9      
  0B0000000000000000, //10
  0B0000000000000000, //11      
  0B0001000000000000, //12
  0B0000000000000000, //13     
  0B0000000000000000, //14
  0B0000000000000000, //15     
  0B0000000000000000, //16

Otherwise, you could look at the word() function.

So I make now this code, but it doesnt work like it should, what do i do wrong?

/*****************************************************************************
Word Clock
 * 
 ******************************************************************************/

#include "TimerOne.h"

 
// Latch-Pin ("LT")
int latchPin = 8 ;

// Clock-Pin ("SK")
int clockPin = 12;

// Data-Pin ("R1I")
int dataPin = 11;

word ntest[32] = {
  0B0000000000000000,  //1    
  0B0000000000000000,  //2
  0B0000000000000000,  //3     
  0B0000000000000000,  //4
  0B0000000000000000,  //5      
  0B0000000000000000, //6
  0B0000000000000000, //7      
  0B0000000000000000, //8
  0B0000000000000000, //9      
  0B0000000000000000, //10
  0B0000000000000000, //11      
  0B0000000000000000, //12
  0B0000000000000000, //13     
  0B0000000000000000, //14
  0B0000000000000000, //15     
  0B0000000000000000, //16
};
word nlc[32] = {
  0B0000000000000000,  //1    
  0B0000000000000000,  //2
  0B0000000000000000,  //3     
  0B0000000000000000,  //4
  0B0000000000000000,  //5      
  0B0000000000000000, //6
  0B0010000000000000, //7      
  0B0010000000000000, //8
  0B0010000000000000, //9      
  0B0010000000000000, //10
  0B0010000000000000, //11      
  0B0010000000000000, //12
  0B0010000000000000, //13     
  0B0010000000000000, //14
  0B0010000000000000, //15     
  0B0010000000000000, //16
      
};
word tld[32] = {
  0B0000000000000000,  //1    
  0B0000000000000000,  //2
  0B0000000000000000,  //3     
  0B0000000000000000,  //4
  0B0000000000000000,  //5      
  0B0000000000000000, //6
  0B0000000000000000, //7      
  0B0000000000000000, //8
  0B0001000000000000, //9      
  0B0001000000000000, //10
  0B0001000000000000, //11      
  0B0001111111111110, //12
  0B0000000000000000, //13     
  0B0000000000000000, //14
  0B0000000000000000, //15     
  0B0000000000000000, //16

};

byte nrows[32] = { 
  B10000000, B00000000,
  B01000000, B00000000,
  B00100000, B00000000,
  B00010000, B00000000,
  B00001000, B00000000,
  B00000100, B00000000,
  B00000010, B00000000,
  B00000001, B00000000,
  B00000000, B10000000,
  B00000000, B01000000,
  B00000000, B00100000,
  B00000000, B00010000,
  B00000000, B00001000,
  B00000000, B00000100,
  B00000000, B00000010,
  B00000000, B00000001
};     
  
byte counter = 0;

void setup() {




  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);


  // Initialize the Timer to 15ms, lower numbers give a more bright matrix, but uses more processing power. 
  Timer1.initialize(15000);

  // Execute the function "draw" every time the timer is fired
  Timer1.attachInterrupt(draw);


}



void loop() {

    

 for (int i = 0; i< sizeof(ntest); i++){
    ntest[i]= ((nlc[i]) || (tld[i]));
 }
// end loop
}

// minutes
  
// Main draw routine
void draw() {

  int offset;

  // draw the icon
  for (int i = 0; i < 32; i+=2) {


    writeLine(ntest[i+offset],  ntest[i+1+offset], nrows[i], nrows[i+1]);

  

    
   
  }

}

// shift register routine
void writeLine(int byte1, int byte2, int byte3, int byte4) {
  digitalWrite(latchPin, LOW);

 
  shiftOut(dataPin, clockPin, MSBFIRST, byte3);  
  shiftOut(dataPin, clockPin, MSBFIRST, byte4);
  shiftOut(dataPin, clockPin, MSBFIRST, byte1);  
  shiftOut(dataPin, clockPin, MSBFIRST, byte2);  

  digitalWrite(latchPin, HIGH);

}

Who wrote this

Initialize the Timer to 15ms, lower numbers give a more bright matrix

It is rubbish, the refresh rate has no effect on the brightness of a multiplexed LED.

Why all the empty lines in the code, it makes it difficult to read.

Why are you outputting the bytes in such an odd order?

but it doesnt work like it should, what do i do wrong?

You do wrong in not saying what it does do. Have you tested that your shift registers are working by just sending out just one bit set and seeing it ends up in the right place.

You need to test things before you try and make it do things.

shiftOut() can only send one byte. Now that your data is held as 16 bit words (well, most of it) you must split the words back into bytes before you can use shiftOut(). You can use highByte() and lowByte().