Reading a variable set in an ISR, or using millis() for time within while loop?

I had to put things back together as I had a mess. So I load to board and it seems to be working now?
I thought I had tried all the logical things to make it work but obviously I had missed something simple. I am putting the code in for anyone like me who may run into problems. Thanks

#define ledPin 8
#define Swin 3


void setup()
{
  pinMode(ledPin, OUTPUT);

pinMode(Swin, OUTPUT);


 // initialize timer1 
  cli();           // disable all interrupts
  TCCR3A = 0;      // Clean the registers
  TCCR3B = 0; 
 // OCR3A = 32767;  // set compare register to desired timer count
 // TCCR3B |= (1<<WGM12); // added this to do CTC function
  TCCR3B |= (1 << CS12) ;//| (1 << CS10); // Prescaler 1024
 TIMSK3 |= (1 << TOIE3);   // enable timer overflow interrupt
 // TIMSK3 |= (1 << OCIE3A);   // enable timer compare interrupt
 sei();             // enable all interrupts

}


ISR(TIMER3_OVF_vect)        // interrupt service routine 
//ISR(TIMER1_COMPA_VECT)
{

  digitalWrite(ledPin, digitalRead(ledPin) ^ 1);

}


void loop()
{
subx();
  
}  
void subx()
{

int whatever = 0;


  while(whatever == 0){
int readledstatus; 

readledstatus = digitalRead(ledPin);

  if ( readledstatus == 0)
{
  digitalWrite(Swin, LOW);
  delay(1000);
  
  
}
  if (readledstatus == 1)
{
  digitalWrite(Swin, HIGH);
  delay(1000);
  
   
}  
}


}