Problems with analysing the RTC and getting correct data

Hey there,

I'm trying to build a clock using an Arduino Nano and 6 IV-11 VFD-Tubes.
After some trial and error from the hardware side everything is running like a dream.

But after many attempts I just can't get the software right so everything is displayed correctly.
My best attempt is shown downbelow, which still isn't working quite right.
The first tube just displays a 2 and the rest just 9.

I hope someone has advise or some tips for me to get this project working.

Greetings

#include <Arduino.h>
#include <Wire.h>         // this #include still required because the RTClib depends on it
#include "RTClib.h"


int SRCLK = 11;
int RCLK = 12;
int SER = 4;   //The three pins connected to the Shiftreg.

int counter = 1;
int nowseconds = 0; 
int nowhours = 0;
int nowminutes = 0;

int numZero = 63;
int numOne = 6;
int numTwo = 91;
int numThree = 79;
int numFour  = 102;
int numFive  = 109;
int numSix   = 125;
int numSeven = 7;
int numEight = 127;
int numNine  = 111;      //The data that is needed to be shifted into the ShiftReg. for the equivalent                       
                                //number to be displayed


RTC_Millis rtc;

void setup() {
 pinMode(10, OUTPUT);
 pinMode(2, OUTPUT);
 pinMode(3, OUTPUT);
 pinMode(6, OUTPUT);
 pinMode(7, OUTPUT);
 pinMode(8, OUTPUT);      //These are the Anodes of the VFD's
 pinMode(SRCLK, OUTPUT);
 pinMode(RCLK, OUTPUT);
 pinMode(SER, OUTPUT);  //Shiftreg. Pins
 rtc.begin(DateTime(F(__DATE__), F(__TIME__)));
 rtc.adjust(DateTime(2017, 11, 19, 19, 0, 0));        //Setting up the RTC for testing
}
 

void loop () {
 DateTime now = rtc.now();   //Recieve the Time
 if (counter = 1){
    nowhours = now.hour();
    int nowhours = nowhours / 10;    //getting the first digit of the hours and putting them in a Int.
    if (nowhours = 0){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, 0);
        digitalWrite(RCLK, HIGH);    
    }
    if (nowhours = 1){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numOne);
        digitalWrite(RCLK, HIGH);
        }
    if (nowhours = 2){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numTwo);
        digitalWrite(RCLK, HIGH);    
    }                                  //three times checking the digit and transferring the data to the ShiftReg.
    digitalWrite(10, HIGH);
    delay(1);
    digitalWrite(10, LOW);   //briefly turning the VFD Number 1 on to display the first Digit
 }

 
 if (counter = 2){
    nowhours = now.hour();     //"resetting" the Int.
    int nowhours = nowhours % 10;     //getting the second digit of the hour
    if (nowhours = 0){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numZero);
        digitalWrite(RCLK, HIGH);
    }
    if (nowhours = 1){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numOne);
        digitalWrite(RCLK, HIGH);
    }
    if (nowhours = 2){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numTwo);
        digitalWrite(RCLK, HIGH);
    }
    if (nowhours = 3){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numThree);
        digitalWrite(RCLK, HIGH);
    }
    if (nowhours = 4){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numFour);
        digitalWrite(RCLK, HIGH);
    }
    if (nowhours = 5){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numFive);
        digitalWrite(RCLK, HIGH);
    }
    if (nowhours = 6){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numSix);
        digitalWrite(RCLK, HIGH);
    }
    if (nowhours = 7){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numSeven);
        digitalWrite(RCLK, HIGH);
    }
    if (nowhours = 8){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numEight);
        digitalWrite(RCLK, HIGH);
    }
    if (nowhours = 9){
        digitalWrite(RCLK, LOW);
        shiftOut(SER, SRCLK, MSBFIRST, numNine);
        digitalWrite(RCLK, HIGH);        
    }          //checking for the second digit and transmitting the data to the ShiftReg.
    digitalWrite(2, HIGH);
    delay(1);
    digitalWrite(2, LOW);    //briefly turning the second VFD on to display the second digit
 }
  if (counter = 3){
    digitalWrite(3, HIGH);
    delay(1);
    digitalWrite(3, LOW);
 }
  if (counter = 4){
    digitalWrite(6, HIGH);
    delay(1);
    digitalWrite(6, LOW); 
 }
   if (counter = 5){
    digitalWrite(7, HIGH);
    delay(1);
    digitalWrite(7, LOW);
 }
  if (counter = 6){
    digitalWrite(8, HIGH);
    delay(1);
    digitalWrite(8, LOW);
 }
           //just turning on the rest of the VFD's for testing purposes
 
if (counter = 6){
  counter = 1;
}
else{
  counter = counter + 1;      //this is used for the purpose of updating one VFD per cycle
  }







 
}
if (counter = 1){

= for assignment, == for comparison. The if statement.

Oh Geez, I always forget this...

Now I've changed every If statement to implement this change.
But now the first VFD stays blank and the rest of them displays 0.

Greetings

Did you create any intermediate test programs that only write test digits to the VFD hardware?

Sure,
i can display any number from 0-9 on any of the 6 VFD's without a problem.
Even a simple sketch that counts up works.

But as soon as I try to combine it with the clock element nothings works quite right.

Did you try embedding debug serial print statements to print the digits at different stages of processing?