Unable to retrieve heart rate reading and send to JY-MCU Bluetooth Hello Arduino Community,

I am encountering an issue trying to retrieve a heart rate reading from an op-amp and instrumentation amplifier and sending it via Bluetooth.  I used this website as a basis of my design:  http://www.instructables.com/id/Electrocardiograph-Heart-Rate-Monitor/?ALLSTEPS.  I would appreciate it if you could take a look at that.  Here are a couple of pictures of my design.



Here is the code that I used:

    const int  signal = 7;    // Pin connected to the filtered signal from the circuit
    unsigned long time;   
    unsigned long frequency;

    // Internal variables
    int period = 2000;
    int starttime = 2000;
    int input = 0;
    int lastinput = 0;
    unsigned long death = 0;

         void setup() {
           pinMode(signal, INPUT);
           Serial.begin(9600);
         }

     void loop() {
       delay(1000);

       time = millis();
       input = digitalRead(signal);

       if ((input != lastinput)&amp;&amp;(input == HIGH)) {
       // If the pin state has just changed from low to high (edge detector)
       period = time - starttime; // Compute the time between the previous beat and the one that has just been detected
       starttime = time; // Define the new time reference for the next period computing
       death = time;
      }
      lastinput = input; // Save the current pin state for comparison at the next loop iteration

      if (period &lt; 0) {
      frequency = 0;
      }
      else {
      frequency = 60000/period; // Compute the heart rate in beats per minute (bpm) with the period in milliseconds
      }


      if ((time - death) &gt; 2000) { // Detect if there is no beat after more than 2 seconds
      Serial.println("dead");
      }

      else {
      char freq[3];

      if (frequency/100 == 0) {
       freq[0] = 32; // Print a space to the first character if the frequency is below 100 bpm
      } 
      else {
       freq[0] = frequency/100+48; // Sort the hundreds character and convert it in ASCII
      }
       freq[1] = (frequency/10)%10+48; // Sort the thents character and convert it in ASCII
       freq[2] = frequency%10+48; // Sort the units character and convert it in ASCII

      Serial.print(freq);
      Serial.print("alive! ");
      }

      }`


But all I'm getting as output is 'dead'.  I am really starting to lose it here since I am a complete amateur with Arduino and circuitry.  For reference, I copied the design from this image from the website (this is just an enlarged version): http://www.instructables.com/file/FVBC6TYHOW0HQ7H/?size=ORIGINAL.  I would appreciate it if anyone could provide some extra guidance.
assuming your circuit works, your code has some serious issues. I rewrote the code for you and also provided a simplified circuit that I have tested and know works.  Instead of getting the pulse from the heartbeat detector circuit, we will simulate it on the Arduino by pulsing pin 2 periodically. 

const int  signal = 7;    // Pin connected to the filtered signal from the circuit
unsigned long currentBeatTime;   
unsigned long previousBeatTime;

unsigned long frequency;

unsigned long myBeatFreq;
unsigned long myBeat;

// Internal variables
unsigned long period = 0;
int input = 0;
int lastinput = 0;


void setup() {
    pinMode(signal, INPUT);
    pinMode(2, OUTPUT);
    Serial.begin(9600);

    previousBeatTime = millis();
    myBeat = previousBeatTime;
}

void loop() {
    if ( millis()-myBeat &gt; myBeatFreq ) 
    {
      digitalWrite(2, HIGH);
      myBeat=millis();
    }
    else
    {
      digitalWrite(2, LOW);
    }

    input = digitalRead(signal);

    if ((input != lastinput) &amp;&amp; (input == HIGH)) {
        // If the pin state has just changed from low to high (edge detector)
        currentBeatTime = millis();

        period = currentBeatTime - previousBeatTime; // Compute the time between the previous beat and the one that has just been detected
        previousBeatTime = currentBeatTime; // Define the new time reference for the next period computing
    }

    lastinput = input; // Save the current pin state for comparison at the next loop iteration

    // Detect if there is no beat after more than 2 seconds
    if ( (millis() - previousBeatTime) &gt; 2000 ) 
    { 
        Serial.println("dead");
    }
    else 
    {
        if (period &lt;= 0) 
        {
            frequency = 0;
        }
        else 
        {
            frequency = 60000/period; // Compute the heart rate in beats per minute (bpm) with the period in milliseconds
        }

        Serial.print(frequency);
        Serial.println(" : alive! ");
    }
}