(Solved) This Blink does not work :-(

This HeartBeat.ino works as it should :

// Heart Beat works on UNO and ETHER TEN
long interval;
int ledState = 0;
int heartBeat = 13;
int scanMs = 50;

void setup()
{
  Serial.begin(9600);
  pinMode( heartBeat, OUTPUT);
}

// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

void loop()
{

  HeartBeat();
  delay(scanMs);

}

//*******************************************************
// Function to Blink the LED on pin 13 @ 1Hz rate

void HeartBeat () {
  if (  interval > 500) {
    if (ledState == 0) {
      ledState = 1;
    }
    else {
      ledState = 0;
    }
    interval = 0;
  }
  else {
    interval = interval + scanMs;
    digitalWrite ( heartBeat, ledState);
  }
}

But the same function inside this slightly larger code does not Blink the LED at all. The LED blinks once at the start of code execution and then goes OFF. Searching for any unintentional point where the LED is made off but have not been able to locate it.

/*
  10 Jan 2016

  Code to read serial Data and write to SD as fixed length Rows being sent by a LabVIEW app.,
  by acknowledging each Row with a OK.. 
  Also can read the contents of the written file in the SD Card and display in Serial Monitor or
  send it to a Android Smartphone running suitable code via the HC-05 Bluetooth module.
   - A basaic handshake implemented : On Pressing START button, kit sends "READY?" to Android
   - In response if the Android sends "ok\n", the kit uploads the CSV file to ANdroid via BT.
   - Fixed file name format used : GPACTUAL.CSV

  Code checked to work OK as above. Only problem is the HeartBeat() function does not work :-(
  

  Hardware is EtherTen Board / UNO board. SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK  - pin 13
 ** CS   - pin 4
*/

#include <SPI.h>
#include <SD.h>
#include <phi_interfaces.h>
#include <EEPROM.h>

int scanMs = 50;
const byte numChars = 85;
char receivedChars[numChars];                                // an array to store the received data
boolean newData = false;
const int chipSelect = 4;                                   // SD card select on shield
const int heartBeat = 13;

// Define the Machine Digital Inputs and Outputs
#define StartPB 3                                          // EtherTen mapping
#define IncrPB 5
#define DecrPB 6
#define EnterPB 7
#define total_buttons 4
char mapDIN[] = {'S', 'I', 'D', 'E'};                      // This is a list of names for each button.
byte pinDIN[] = { StartPB, IncrPB, DecrPB, EnterPB};       // The digital pins connected to the 4 buttons.
phi_button_groups MyDIN(mapDIN, pinDIN, total_buttons);

char ValidDIN = '0';
boolean rdAllData = false;
int static recordCount = 0;
long interval = 0;
int ledState = LOW;

// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//                        SETUP 
// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

void setup()
{
  Serial.begin(9600);
  Serial.println(F("Initializing SD card..."));           // Check if the card is present and can be initialized:

  if (!SD.begin(chipSelect)) {
    Serial.println(F("Card failed, or not present"));
    return;                                               // No card .. just return..
  }
  Serial.println("");
  Serial.println(F("SD Card initialized."));
  Serial.println(F("SerialToSD program ready "));
 
  pinMode(chipSelect, OUTPUT);
  pinMode(heartBeat, OUTPUT);
}


// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//                      MAIN LOOP 
// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


void loop()
{
  HeartBeat();                                          // Just to know the processor is alive...
  
  ValidDIN = MyDIN.getKey();
  

  if ( ValidDIN == 'S') {                               // Read from SD card and send to Serial Monitor / HC-05 Bluetooth.
    rdAllData = true;
    readFromSD();
    ValidDIN = '0';
  }

  recvWithStartEndMarkers();                           // Read data from Serial port and store to SD card..
  processNewData();

 //Serial.println(interval);
  delay(scanMs);
}

// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//                       FUNCTIONS
// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

// Function to Read data in Serial buffer and load in a variable..
void recvWithStartEndMarkers() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '[';
  char endMarker = ']';
  char inChar;

  if (Serial.available() > 0) {                                   // Data available in In buffer ?
    while (Serial.available() > 0 && newData == false ) {         // As long as there is data...
      inChar = Serial.read();                                     // Read the data and add to char array

      if (recvInProgress == true) {
        if (inChar != endMarker) {                                // Upon StartMarker Read char and add to Char array
          receivedChars[ndx] = inChar;                            // till the EndMarker arrives
          ndx++;
          if (ndx >= numChars) {
            ndx = numChars - 1;
          }
        }
        else {
          //receivedChars[ndx] = '\0';                            // Terminate the string
          recvInProgress = false;                                 // reset variable for next read..
          ndx = 0;
          newData = true;
        }
      }
      else if ( inChar == startMarker) {                         // OK StartMarker received...
        recvInProgress = true;
        recordCount = 0;
      }
    }
  }
}

// **********************************************************
// Function to write stored data in variable to SD card file..
void processNewData() {
  if ( newData == true) {
    File dataFile = SD.open("GPACTUAL.CSV", FILE_WRITE);       // Open the file and write to it..
    if (dataFile) {
      dataFile.println(receivedChars);
      dataFile.close();
      Serial.println("OK");
      recordCount++;
      newData = false;
    }
    else {
      Serial.println(F("Error opening GPACTUAL.CSV"));
    }
  }
}

// **********************************************************
// Function to read from SD card and send to serial monitor based on a Digital input
void readFromSD() {

  String respString ;

  Serial.println(F( "READY?"));
  
    while ( rdAllData == true ) {
      while (Serial.available()) {
        char c = Serial.read();                               //gets one byte from serial buffer
        respString += c;                                      //adds to the string readString
      }
      if ( respString == "ok\n" ) {
        File dataFile = SD.open("GPACTUAL.CSV", FILE_READ);
        if (!dataFile) {                                      // Problem opening data file..quit!
          Serial.println(F("Error opening GPACTUAL.CSV"));
          rdAllData = false;
        }
        else
        {
          while (dataFile.available()) {                     // Data file exists ..read it.
            Serial.write(dataFile.read());
          }
          dataFile.close();
          rdAllData = false;
        }
      }
    }
  }

//***********************************************************
// Function to blink the LED on pin 13 at 1 Hz rate..
void HeartBeat() {
  if (  interval > 500) {                              
    if (ledState == 0) {
      ledState = 1;
    }
    else  {
      ledState = 0;
    }
    interval = 0;
  }
  else {
    interval = interval + scanMs;
    digitalWrite(heartBeat, ledState);
  }
}

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

You are using pin 13 for the LED but that is used as the SPI CLK pin.

Yes. Thanks. Mind goes blank after a whole day of looking at code ;-))