   }
 }
 
-unsigned char getResponse(unsigned char responseFlag) {
+unsigned char getResponse(bool responseFlag) {
   int i = 0;
   unsigned char response[bufferSize];
   response[7] = NULL;


void loop() { 
  bool standby = true;
  unsigned char responseFlag = NULL;
  unsigned long elapsedTime = 0;
  
  // send command packet to RDM880 to read serial number every second
  MF_GET_SNR(0x00);
  delay(100);
  digitalWrite(ledPin, LOW);

  responseFlag = getResponse(responseFlag);
  
  // LED on if an RFID is detected (idle packet only contains 7 bytes)
  if(responseFlag != NULL) {
    digitalWrite(ledPin, HIGH);
    // Machine is ready to fire, get ready to track time
    standby = false;

  }

  if (response[7] != NULL)
    return true;
  else
    return false;   
}

unsigned char checksum(unsigned char A[], int numElements) {
  int i = 0;
  unsigned char BCC = A[0];
  
  for(i = 1; i < numElements - 1; i++) {
    BCC ^= A[i]; 
  }

  return BCC;
}

void MF_GET_SNR(unsigned char DADD) {
  BCC = checksum( { DADD, 0x03, CMD_GET_SNR, 0x26, 0x00 }, 5);
  unsigned char CMD[] = { STX, DADD, 0x03, CMD_GET_SNR, 0x26, 0x00, BCC, ETX};
  RDM880.write(CMD, 8);
}

void MF_READ(unsigned char numBlocks, unsigned char startSector) {
  int i = 0;
  BCC = checksum( { 0x00, 0x0A, CMD_READ, 0x01, numBlocks, startSector, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 12);
  unsigned char CMD[] = { STX, 0x00, 0x0A, CMD_READ, 0x01, numBlocks, startSector,
                          0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, BCC, ETX };
  unsigned char response[bufferSize];

  while(RDM880.available()) {
    response[i] = RDM880.read();
    Serial.print(response[i], HEX);
    Serial.print(" ");
    i++;
  }
  
}

