user57961: I've been building an add on to my garage door opener that will allow it to be opened from the outside with a valid RFID token or from inside using push buttons. 
This works as expected when first plugged in, but then after a few hours, the RFID component stops responding to swipes. The push buttons continue to allow the door to be opened, closed or halted during an action.
I'm not sure if this is  an electrical hardware issue or a code based bug, but any help is appreciated.  

#include <AddicoreRFID.h>
#include <SPI.h>

#define  uchar unsigned char
#define uint  unsigned int

uchar fifobytes;
uchar fifoValue;

AddicoreRFID myRFID; // create AddicoreRFID object to control the RFID module

// ------------
// Open / Close Garage Door
// ------------

/*-------------

Every program based on Wiring (programming language used by Arduino, and Particle devices) has two essential parts:
setup - runs once at the beginning of your program
loop - runs continuously over and over

-------------*/


// First, we're going to make some variables.
// This is our "shorthand" that we'll use throughout the program:

int re1 = 8                                                                                                                                                                                                                                                                                                                                 ; // Relay IN1 Blue
int re2 = 7; // Relay IN2 Purple
int re3 = 6; // Relay IN3 Orange
int re4 = 5; // Relay IN4 Yellow
int btn1 = 3;
int btn2 = 4;
int btn3 = 2;

int OpenButtonState = 0;
int CloseButtonState = 0;
int StopButtonState = 0;

int doorstate = 0; // 0 = "Closed", 1 = "Open"

//--Pins for RFID

const int chipSelectPin = 10;
const int NRSTPD = 9;

//Maximum length of the array
#define MAX_LEN 16

//End of RFID Pin Config

void setup() {

  Serial.begin(9600);      // open the serial port at 9600 bps:  
//setup the pins to output voltage
  pinMode(re1, OUTPUT);
  pinMode(re2, OUTPUT);
  pinMode(re3, OUTPUT);
  pinMode(re4, OUTPUT);
  pinMode(btn1, INPUT);
  pinMode(btn2, INPUT);
  pinMode(btn3, INPUT);


   // start the SPI library:
  SPI.begin();

  pinMode(chipSelectPin,OUTPUT);              // Set digital pin 10 as OUTPUT to connect it to the RFID /ENABLE pin 
    digitalWrite(chipSelectPin, LOW);         // Activate the RFID reader
  pinMode(NRSTPD,OUTPUT);                     // Set digital pin 9 , Not Reset and Power-down
    digitalWrite(NRSTPD, HIGH);

  myRFID.AddicoreRFID_Init(); 



//setup web call functions 

//Particle.function("netopen", R1ON);
//Particle.function("netclose", R2ON);
//Particle.function("netstop", R3ON);


  digitalWrite(re1, HIGH); //turn off relay
  digitalWrite(re2, HIGH); //turn off relay
  digitalWrite(re3, HIGH); //turn off relay
  digitalWrite(re4, HIGH); //turn off relay


}

// This routine gets repeated over and over, as quickly as possible and as many times as possible, after the setup function is called.
// Note: Code that blocks for too long (like more than 5 seconds), can make weird things happen (like dropping the network connection).  The built-in delay function shown below safely interleaves required background activity, so arbitrarily long delays can safely be done if you need them.

void loop() {

//Loop for RFID ----------------------------------------------------------------------


uchar i, tmp, checksum1;
  uchar status;
        uchar str[MAX_LEN];
        uchar RC_size;
        uchar blockAddr;  //Selection operation block address 0 to 63
        String mynum = "";

        str[1] = 0x4400;
  //Find tags, return tag type
  status = myRFID.AddicoreRFID_Request(PICC_REQIDL, str); 
  if (status == MI_OK)
  {
          Serial.println("RFID tag detected");
                 }


  //Anti-collision, return tag serial number 4 bytes
  status = myRFID.AddicoreRFID_Anticoll(str);
  if (status == MI_OK)
  {
          checksum1 = str[0] ^ str[1] ^ str[2] ^ str[3];
          Serial.print("The tag's number is:\t");
          Serial.print(str[0]);
            Serial.print(" , ");
          Serial.print(str[1]);
            Serial.print(" , ");
          Serial.print(str[2]);
            Serial.print(" , ");
          Serial.println(str[3]);

//check if valid card combination
            if((str[0] == 333) && (str[1] == 444) && (str[2] == 555) && (str[3] == 666) )                   //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
            {
                Serial.println("\nKey fob identifed - Josh\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(""); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(""); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }




            } else if((str[0] == 111) && (str[1] == 2222) && (str[2] == 333) && (str[3] == 444) ) {             //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
                Serial.println("\nCar Charge Card Identified - Josh\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(""); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(""); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }
            } else if((str[0] == 000) && (str[1] == 11) && (str[2] == 22) && (str[3] == 333) ) {             //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
                Serial.println("\nCar Garage Card Identified - Charlotte\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(""); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(""); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }
            }
            Serial.println();
            delay(1000);
  }

        myRFID.AddicoreRFID_Halt();      //Command tag into hibernation 

   //End Loop For RFID  ----------------------------------------------------------------------



OpenButtonState = digitalRead(btn1);
CloseButtonState = digitalRead(btn2);
StopButtonState = digitalRead(btn3);

if (OpenButtonState == HIGH) {

  Serial.print("Open State Button HIGH - Opening Garage Door")  ;
  Serial.println(""); 
    //Open Garage Door
  R1ON(""); //turn on relay
  doorstate = 1;
  Serial.print("Relay 1 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R1OFF(); //turn off relay
  Serial.print("Relay 1 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
  Serial.println(""); 
  } 

if (CloseButtonState == HIGH) {

  Serial.print("Close State Button HIGH - Closing Garage Door") ;
  Serial.println(""); 
    // Close Garage Door  
  R2ON(""); //turn on relay
  doorstate = 0;
  Serial.print("Relay 2 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R2OFF(); //turn off relay
  Serial.print("Relay 2 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
    Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
  Serial.println("");

  } 

if (StopButtonState == HIGH) {

 Serial.print("Stop State Button HIGH - Stopping Garage Door")  ;
 Serial.println("");   
 // Stop
  R3ON(""); //turn on relay
  doorstate = 1;
  Serial.print("Relay 3 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R3OFF(); //turn off relay
  Serial.print("Relay 3 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
      Serial.print("Stop State Button HIGH - Finished Stopping Garage Door")    ;
  Serial.println("");

  } 


  // And repeat!
}

int R1ON(String command) {

    digitalWrite(re1, LOW); //turn on relay
    //Particle.publish("Relay 1 on - Door Open");
    delay(1000); // wait 1 second
    digitalWrite(re1, HIGH); //turn off relay
    //Particle.publish("Relay 1 off");
}

void R1OFF() {
  digitalWrite(re1, HIGH); //turn off relay
    //delay(1000); // wait 1 second
}

int R2ON(String command) {

    digitalWrite(re2, LOW); //turn on relay
    //Particle.publish("Relay 2 on - Door Closing");
    delay(1000); // wait 1 second
    digitalWrite(re2, HIGH); //turn off relay
    //Particle.publish("Relay 2 off");
}

void R2OFF() {

    digitalWrite(re2, HIGH); //turn on relay
    //delay(1000); // wait 1 second
}

int R3ON(String command) {

    digitalWrite(re3, LOW); //turn on relay
    //Particle.publish("Relay 3 on - Door Stopped");
    delay(1000); // wait 1 second
    digitalWrite(re3, HIGH); //turn off relay
    //Particle.publish("Relay 3 off");
}

void R3OFF() {

    digitalWrite(re3, HIGH); //turn on relay
    //delay(1000); // wait 1 second
}

void R4ON() {

    digitalWrite(re4, LOW); //turn on relay
    //delay(1000); // wait 1 second
}

void R4OFF() {

    digitalWrite(re4, HIGH); //turn on relay
    //delay(1000); // wait 1 second
}

Updated Code 7/7/19 @20:53
#include <AddicoreRFID.h>
#include <SPI.h>

//#define  unsigned char unsigned char
#define uint  unsigned int

unsigned char fifobytes;
unsigned char fifoValue;

AddicoreRFID myRFID; // create AddicoreRFID object to control the RFID module

// ------------
// Open / Close Garage Door
// ------------

/*-------------

Every program based on Wiring (programming language used by Arduino, and Particle devices) has two essential parts:
setup - runs once at the beginning of your program
loop - runs continuously over and over

-------------*/


// First, we're going to make some variables.
// This is our "shorthand" that we'll use throughout the program:

int re1 = 8                                                                                                                                                                                                                                                                                                                                 ; // Relay IN1 Blue
int re2 = 7; // Relay IN2 Purple
int re3 = 6; // Relay IN3 Orange
int re4 = 5; // Relay IN4 Yellow
int btn1 = 3;
int btn2 = 4;
int btn3 = 2;

int OpenButtonState = 0;
int CloseButtonState = 0;
int StopButtonState = 0;

int doorstate = 0; // 0 = "Closed", 1 = "Open"

//--Pins for RFID

const int chipSelectPin = 10;
const int NRSTPD = 9;

//Maximum length of the array
#define MAX_LEN 16

//End of RFID Pin Config

void setup() {

  Serial.begin(9600);      // open the serial port at 9600 bps:  
//setup the pins to output voltage
  pinMode(re1, OUTPUT);
  pinMode(re2, OUTPUT);
  pinMode(re3, OUTPUT);
  pinMode(re4, OUTPUT);
  pinMode(btn1, INPUT);
  pinMode(btn2, INPUT);
  pinMode(btn3, INPUT);


   // start the SPI library:
  SPI.begin();

  pinMode(chipSelectPin,OUTPUT);              // Set digital pin 10 as OUTPUT to connect it to the RFID /ENABLE pin 
    digitalWrite(chipSelectPin, LOW);         // Activate the RFID reader
  pinMode(NRSTPD,OUTPUT);                     // Set digital pin 9 , Not Reset and Power-down
    digitalWrite(NRSTPD, HIGH);

  myRFID.AddicoreRFID_Init(); 



//setup web call functions 

//Particle.function("netopen", R1ON);
//Particle.function("netclose", R2ON);
//Particle.function("netstop", R3ON);


  digitalWrite(re1, HIGH); //turn off relay
  digitalWrite(re2, HIGH); //turn off relay
  digitalWrite(re3, HIGH); //turn off relay
  digitalWrite(re4, HIGH); //turn off relay


}

// This routine gets repeated over and over, as quickly as possible and as many times as possible, after the setup function is called.
// Note: Code that blocks for too long (like more than 5 seconds), can make weird things happen (like dropping the network connection).  The built-in delay function shown below safely interleaves required background activity, so arbitrarily long delays can safely be done if you need them.

void loop() {

//Loop for RFID ----------------------------------------------------------------------


//unsigned char checksum1;
  unsigned char status;
        unsigned char str[MAX_LEN];
        //unsigned char RC_size;
        //unsigned char blockAddr;  //Selection operation block address 0 to 63
        //String mynum = "";

        str[1] = 0x4400;
  //Find tags, return tag type
  status = myRFID.AddicoreRFID_Request(PICC_REQIDL, str); 
  if (status == MI_OK)
  {
          Serial.println("RFID tag detected");
                 }


  //Anti-collision, return tag serial number 4 bytes
  status = myRFID.AddicoreRFID_Anticoll(str);
  if (status == MI_OK)
  {
//          checksum1 = str[0] ^ str[1] ^ str[2] ^ str[3];
          Serial.print("The tag's number is:\t");
          Serial.print(str[0]);
            Serial.print(" , ");
          Serial.print(str[1]);
            Serial.print(" , ");
          Serial.print(str[2]);
            Serial.print(" , ");
          Serial.println(str[3]);

//check if valid card combination
            if((str[0] == 333) && (str[1] == 444) && (str[2] == 555) && (str[3] == 666) )                   //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
            {
                Serial.println("\nKey fob identifed - Josh\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }




            } else if((str[0] == 222) && (str[1] == 333) && (str[2] == 444) && (str[3] == 555) ) {             //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
                Serial.println("\nCar Charge Card Identided - Josh\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }
            } else if((str[0] == 111) && (str[1] == 222 && (str[2] == 333) && (str[3] == 444) ) {             //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
                Serial.println("\nCar Garage Card Identided - Charlotte\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }
            }
            Serial.println();
            delay(1000);
  }

        myRFID.AddicoreRFID_Halt();      //Command tag into hibernation 

   //End Loop For RFID  ----------------------------------------------------------------------



OpenButtonState = digitalRead(btn1);
CloseButtonState = digitalRead(btn2);
StopButtonState = digitalRead(btn3);

if (OpenButtonState == HIGH) {

  Serial.print("Open State Button HIGH - Opening Garage Door")  ;
  Serial.println(""); 
    //Open Garage Door
  R1ON(); //turn on relay
  doorstate = 1;
  Serial.print("Relay 1 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R1OFF(); //turn off relay
  Serial.print("Relay 1 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
  Serial.println(""); 
  } 

if (CloseButtonState == HIGH) {

  Serial.print("Close State Button HIGH - Closing Garage Door") ;
  Serial.println(""); 
    // Close Garage Door  
  R2ON(); //turn on relay
  doorstate = 0;
  Serial.print("Relay 2 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R2OFF(); //turn off relay
  Serial.print("Relay 2 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
    Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
  Serial.println("");

  } 

if (StopButtonState == HIGH) {

 Serial.print("Stop State Button HIGH - Stopping Garage Door")  ;
 Serial.println("");   
 // Stop
  R3ON(); //turn on relay
  doorstate = 1;
  Serial.print("Relay 3 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R3OFF(); //turn off relay
  Serial.print("Relay 3 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
      Serial.print("Stop State Button HIGH - Finished Stopping Garage Door")    ;
  Serial.println("");

  } 


  // And repeat!
}

void R1ON() {

    digitalWrite(re1, LOW); //turn on relay
    //Particle.publish("Relay 1 on - Door Open");
    delay(1000); // wait 1 second
    digitalWrite(re1, HIGH); //turn off relay
    //Particle.publish("Relay 1 off");

}

void R1OFF() {
  digitalWrite(re1, HIGH); //turn off relay
    //delay(1000); // wait 1 second


}

void R2ON() {

    digitalWrite(re2, LOW); //turn on relay
    //Particle.publish("Relay 2 on - Door Closing");
    delay(1000); // wait 1 second
    digitalWrite(re2, HIGH); //turn off relay
    //Particle.publish("Relay 2 off");

}

void R2OFF() {

    digitalWrite(re2, HIGH); //turn on relay
    //delay(1000); // wait 1 second

}

void R3ON() {

    digitalWrite(re3, LOW); //turn on relay
    //Particle.publish("Relay 3 on - Door Stopped");
    delay(1000); // wait 1 second
    digitalWrite(re3, HIGH); //turn off relay
    //Particle.publish("Relay 3 off");

}

void R3OFF() {

    digitalWrite(re3, HIGH); //turn on relay
    //delay(1000); // wait 1 second

}

void R4ON() {

    digitalWrite(re4, LOW); //turn on relay
    //delay(1000); // wait 1 second

}

void R4OFF() {

    digitalWrite(re4, HIGH); //turn on relay
    //delay(1000); // wait 1 second

}


user20245: Consider removing the type String from the code including removing where String is used in passing formal values to some functions.  It appears to do nothing.  And if the compiler does not optimize it out, could actually be consuming what little RAM the embedded processor contains. 
The type String loads in all kinds of help you may or may not need.  Generally String is a bad idea for embedded processors because Sting consumes a large amount of resources to support all of String's features. And sometimes those resources are not given back.  This is generally referred to as a memory leak. Briefly, this is when the RAM in an embedded processor is considered used by the program, but is not actually being used by the programmer.  

user57952: In 50+ years of dealing with hardware/software issues, I've found that the culprit is almost never the hardware. So, your problem is most likely the software.
To start with, there are several major problems with your code:

You are using an unsigned char type to represent integer values > 256; this will not work.  When I tried to compile your code, one of the many error messages was "StackOvrFl.ino: 107:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]" on the line 'str[1] = 0x4400;' You need to declare 'str' as 'unsigned int str[MAX_LEN];'.
It's really bad form to use 'nicknames' ('uchar') for types; If someone else needs to maintain or modify your code (or help you with it as in this case), they are going to trip over that and emit 4-letter words in your direction.
Turn on compiler warnings and errors, and don't stop debugging until all such warnings/errors are cleared.  The compiler is your friend; let it help you.
If you had turned on compiler warnings/errors, you would have found that the identifier 'MI_OK' was never declared, and so can have ANY VALUE when you check it.

The combination of the integer overflow and undeclared symbol problems will almost undoubtedly cause undefined behavior, but there may be other issues as well.  Clean up your code, pay attention to compiler warnings, and then see what happens.
Good luck!
Frank

57961: <p>I've been building an add on to my garage door opener that will allow it to be opened from the outside with a valid RFID token or from inside using push buttons. </p>

<p>This works as expected when first plugged in, but then after a few hours, the RFID component stops responding to swipes. The push buttons continue to allow the door to be opened, closed or halted during an action.</p>

<p>I'm not sure if this is  an electrical hardware issue or a code based bug, but any help is appreciated.  </p>

<p><a href="https://i.stack.imgur.com/bZgqU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bZgqU.jpg" alt="Hardware Sketch"></a></p>

<pre><code>#include &lt;AddicoreRFID.h&gt;
#include &lt;SPI.h&gt;

#define  uchar unsigned char
#define uint  unsigned int

uchar fifobytes;
uchar fifoValue;

AddicoreRFID myRFID; // create AddicoreRFID object to control the RFID module

// ------------
// Open / Close Garage Door
// ------------

/*-------------

Every program based on Wiring (programming language used by Arduino, and Particle devices) has two essential parts:
setup - runs once at the beginning of your program
loop - runs continuously over and over

-------------*/


// First, we're going to make some variables.
// This is our "shorthand" that we'll use throughout the program:

int re1 = 8                                                                                                                                                                                                                                                                                                                                 ; // Relay IN1 Blue
int re2 = 7; // Relay IN2 Purple
int re3 = 6; // Relay IN3 Orange
int re4 = 5; // Relay IN4 Yellow
int btn1 = 3;
int btn2 = 4;
int btn3 = 2;

int OpenButtonState = 0;
int CloseButtonState = 0;
int StopButtonState = 0;

int doorstate = 0; // 0 = "Closed", 1 = "Open"

//--Pins for RFID

const int chipSelectPin = 10;
const int NRSTPD = 9;

//Maximum length of the array
#define MAX_LEN 16

//End of RFID Pin Config

void setup() {

  Serial.begin(9600);      // open the serial port at 9600 bps:  
//setup the pins to output voltage
  pinMode(re1, OUTPUT);
  pinMode(re2, OUTPUT);
  pinMode(re3, OUTPUT);
  pinMode(re4, OUTPUT);
  pinMode(btn1, INPUT);
  pinMode(btn2, INPUT);
  pinMode(btn3, INPUT);


   // start the SPI library:
  SPI.begin();

  pinMode(chipSelectPin,OUTPUT);              // Set digital pin 10 as OUTPUT to connect it to the RFID /ENABLE pin 
    digitalWrite(chipSelectPin, LOW);         // Activate the RFID reader
  pinMode(NRSTPD,OUTPUT);                     // Set digital pin 9 , Not Reset and Power-down
    digitalWrite(NRSTPD, HIGH);

  myRFID.AddicoreRFID_Init(); 



//setup web call functions 

//Particle.function("netopen", R1ON);
//Particle.function("netclose", R2ON);
//Particle.function("netstop", R3ON);


  digitalWrite(re1, HIGH); //turn off relay
  digitalWrite(re2, HIGH); //turn off relay
  digitalWrite(re3, HIGH); //turn off relay
  digitalWrite(re4, HIGH); //turn off relay


}

// This routine gets repeated over and over, as quickly as possible and as many times as possible, after the setup function is called.
// Note: Code that blocks for too long (like more than 5 seconds), can make weird things happen (like dropping the network connection).  The built-in delay function shown below safely interleaves required background activity, so arbitrarily long delays can safely be done if you need them.

void loop() {

//Loop for RFID ----------------------------------------------------------------------


uchar i, tmp, checksum1;
  uchar status;
        uchar str[MAX_LEN];
        uchar RC_size;
        uchar blockAddr;  //Selection operation block address 0 to 63
        String mynum = "";

        str[1] = 0x4400;
  //Find tags, return tag type
  status = myRFID.AddicoreRFID_Request(PICC_REQIDL, str); 
  if (status == MI_OK)
  {
          Serial.println("RFID tag detected");
                 }


  //Anti-collision, return tag serial number 4 bytes
  status = myRFID.AddicoreRFID_Anticoll(str);
  if (status == MI_OK)
  {
          checksum1 = str[0] ^ str[1] ^ str[2] ^ str[3];
          Serial.print("The tag's number is:\t");
          Serial.print(str[0]);
            Serial.print(" , ");
          Serial.print(str[1]);
            Serial.print(" , ");
          Serial.print(str[2]);
            Serial.print(" , ");
          Serial.println(str[3]);

//check if valid card combination
            if((str[0] == 333) &amp;&amp; (str[1] == 444) &amp;&amp; (str[2] == 555) &amp;&amp; (str[3] == 666) )                   //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
            {
                Serial.println("\nKey fob identifed - Josh\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(""); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(""); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }




            } else if((str[0] == 111) &amp;&amp; (str[1] == 2222) &amp;&amp; (str[2] == 333) &amp;&amp; (str[3] == 444) ) {             //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
                Serial.println("\nCar Charge Card Identified - Josh\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(""); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(""); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }
            } else if((str[0] == 000) &amp;&amp; (str[1] == 11) &amp;&amp; (str[2] == 22) &amp;&amp; (str[3] == 333) ) {             //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
                Serial.println("\nCar Garage Card Identified - Charlotte\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(""); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(""); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }
            }
            Serial.println();
            delay(1000);
  }

        myRFID.AddicoreRFID_Halt();      //Command tag into hibernation 

   //End Loop For RFID  ----------------------------------------------------------------------



OpenButtonState = digitalRead(btn1);
CloseButtonState = digitalRead(btn2);
StopButtonState = digitalRead(btn3);

if (OpenButtonState == HIGH) {

  Serial.print("Open State Button HIGH - Opening Garage Door")  ;
  Serial.println(""); 
    //Open Garage Door
  R1ON(""); //turn on relay
  doorstate = 1;
  Serial.print("Relay 1 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R1OFF(); //turn off relay
  Serial.print("Relay 1 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
  Serial.println(""); 
  } 

if (CloseButtonState == HIGH) {

  Serial.print("Close State Button HIGH - Closing Garage Door") ;
  Serial.println(""); 
    // Close Garage Door  
  R2ON(""); //turn on relay
  doorstate = 0;
  Serial.print("Relay 2 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R2OFF(); //turn off relay
  Serial.print("Relay 2 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
    Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
  Serial.println("");

  } 

if (StopButtonState == HIGH) {

 Serial.print("Stop State Button HIGH - Stopping Garage Door")  ;
 Serial.println("");   
 // Stop
  R3ON(""); //turn on relay
  doorstate = 1;
  Serial.print("Relay 3 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R3OFF(); //turn off relay
  Serial.print("Relay 3 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
      Serial.print("Stop State Button HIGH - Finished Stopping Garage Door")    ;
  Serial.println("");

  } 


  // And repeat!
}

int R1ON(String command) {

    digitalWrite(re1, LOW); //turn on relay
    //Particle.publish("Relay 1 on - Door Open");
    delay(1000); // wait 1 second
    digitalWrite(re1, HIGH); //turn off relay
    //Particle.publish("Relay 1 off");
}

void R1OFF() {
  digitalWrite(re1, HIGH); //turn off relay
    //delay(1000); // wait 1 second
}

int R2ON(String command) {

    digitalWrite(re2, LOW); //turn on relay
    //Particle.publish("Relay 2 on - Door Closing");
    delay(1000); // wait 1 second
    digitalWrite(re2, HIGH); //turn off relay
    //Particle.publish("Relay 2 off");
}

void R2OFF() {

    digitalWrite(re2, HIGH); //turn on relay
    //delay(1000); // wait 1 second
}

int R3ON(String command) {

    digitalWrite(re3, LOW); //turn on relay
    //Particle.publish("Relay 3 on - Door Stopped");
    delay(1000); // wait 1 second
    digitalWrite(re3, HIGH); //turn off relay
    //Particle.publish("Relay 3 off");
}

void R3OFF() {

    digitalWrite(re3, HIGH); //turn on relay
    //delay(1000); // wait 1 second
}

void R4ON() {

    digitalWrite(re4, LOW); //turn on relay
    //delay(1000); // wait 1 second
}

void R4OFF() {

    digitalWrite(re4, HIGH); //turn on relay
    //delay(1000); // wait 1 second
}
</code></pre>

<p>Updated Code 7/7/19 @20:53</p>

<pre><code>#include &lt;AddicoreRFID.h&gt;
#include &lt;SPI.h&gt;

//#define  unsigned char unsigned char
#define uint  unsigned int

unsigned char fifobytes;
unsigned char fifoValue;

AddicoreRFID myRFID; // create AddicoreRFID object to control the RFID module

// ------------
// Open / Close Garage Door
// ------------

/*-------------

Every program based on Wiring (programming language used by Arduino, and Particle devices) has two essential parts:
setup - runs once at the beginning of your program
loop - runs continuously over and over

-------------*/


// First, we're going to make some variables.
// This is our "shorthand" that we'll use throughout the program:

int re1 = 8                                                                                                                                                                                                                                                                                                                                 ; // Relay IN1 Blue
int re2 = 7; // Relay IN2 Purple
int re3 = 6; // Relay IN3 Orange
int re4 = 5; // Relay IN4 Yellow
int btn1 = 3;
int btn2 = 4;
int btn3 = 2;

int OpenButtonState = 0;
int CloseButtonState = 0;
int StopButtonState = 0;

int doorstate = 0; // 0 = "Closed", 1 = "Open"

//--Pins for RFID

const int chipSelectPin = 10;
const int NRSTPD = 9;

//Maximum length of the array
#define MAX_LEN 16

//End of RFID Pin Config

void setup() {

  Serial.begin(9600);      // open the serial port at 9600 bps:  
//setup the pins to output voltage
  pinMode(re1, OUTPUT);
  pinMode(re2, OUTPUT);
  pinMode(re3, OUTPUT);
  pinMode(re4, OUTPUT);
  pinMode(btn1, INPUT);
  pinMode(btn2, INPUT);
  pinMode(btn3, INPUT);


   // start the SPI library:
  SPI.begin();

  pinMode(chipSelectPin,OUTPUT);              // Set digital pin 10 as OUTPUT to connect it to the RFID /ENABLE pin 
    digitalWrite(chipSelectPin, LOW);         // Activate the RFID reader
  pinMode(NRSTPD,OUTPUT);                     // Set digital pin 9 , Not Reset and Power-down
    digitalWrite(NRSTPD, HIGH);

  myRFID.AddicoreRFID_Init(); 



//setup web call functions 

//Particle.function("netopen", R1ON);
//Particle.function("netclose", R2ON);
//Particle.function("netstop", R3ON);


  digitalWrite(re1, HIGH); //turn off relay
  digitalWrite(re2, HIGH); //turn off relay
  digitalWrite(re3, HIGH); //turn off relay
  digitalWrite(re4, HIGH); //turn off relay


}

// This routine gets repeated over and over, as quickly as possible and as many times as possible, after the setup function is called.
// Note: Code that blocks for too long (like more than 5 seconds), can make weird things happen (like dropping the network connection).  The built-in delay function shown below safely interleaves required background activity, so arbitrarily long delays can safely be done if you need them.

void loop() {

//Loop for RFID ----------------------------------------------------------------------


//unsigned char checksum1;
  unsigned char status;
        unsigned char str[MAX_LEN];
        //unsigned char RC_size;
        //unsigned char blockAddr;  //Selection operation block address 0 to 63
        //String mynum = "";

        str[1] = 0x4400;
  //Find tags, return tag type
  status = myRFID.AddicoreRFID_Request(PICC_REQIDL, str); 
  if (status == MI_OK)
  {
          Serial.println("RFID tag detected");
                 }


  //Anti-collision, return tag serial number 4 bytes
  status = myRFID.AddicoreRFID_Anticoll(str);
  if (status == MI_OK)
  {
//          checksum1 = str[0] ^ str[1] ^ str[2] ^ str[3];
          Serial.print("The tag's number is:\t");
          Serial.print(str[0]);
            Serial.print(" , ");
          Serial.print(str[1]);
            Serial.print(" , ");
          Serial.print(str[2]);
            Serial.print(" , ");
          Serial.println(str[3]);

//check if valid card combination
            if((str[0] == 333) &amp;&amp; (str[1] == 444) &amp;&amp; (str[2] == 555) &amp;&amp; (str[3] == 666) )                   //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
            {
                Serial.println("\nKey fob identifed - Josh\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }




            } else if((str[0] == 222) &amp;&amp; (str[1] == 333) &amp;&amp; (str[2] == 444) &amp;&amp; (str[3] == 555) ) {             //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
                Serial.println("\nCar Charge Card Identided - Josh\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }
            } else if((str[0] == 111) &amp;&amp; (str[1] == 222 &amp;&amp; (str[2] == 333) &amp;&amp; (str[3] == 444) ) {             //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
                Serial.println("\nCar Garage Card Identided - Charlotte\n");

                if(doorstate == 1) {
                  //door is already open so close
                    // Close Garage Door  
                    R2ON(); //turn on relay
                    doorstate = 0;
                    Serial.print("Relay 2 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R2OFF(); //turn off relay
                    Serial.print("Relay 2 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                      Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
                    Serial.println("");

                } else {
                  //door is closed so open

                    //Open Garage Door
                    R1ON(); //turn on relay
                    doorstate = 1;
                    Serial.print("Relay 1 on") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    R1OFF(); //turn off relay
                    Serial.print("Relay 1 off") ;
                    Serial.println(""); 
                    delay(1000); // wait 1 second
                    Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
                    Serial.println(""); 
                }
            }
            Serial.println();
            delay(1000);
  }

        myRFID.AddicoreRFID_Halt();      //Command tag into hibernation 

   //End Loop For RFID  ----------------------------------------------------------------------



OpenButtonState = digitalRead(btn1);
CloseButtonState = digitalRead(btn2);
StopButtonState = digitalRead(btn3);

if (OpenButtonState == HIGH) {

  Serial.print("Open State Button HIGH - Opening Garage Door")  ;
  Serial.println(""); 
    //Open Garage Door
  R1ON(); //turn on relay
  doorstate = 1;
  Serial.print("Relay 1 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R1OFF(); //turn off relay
  Serial.print("Relay 1 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  Serial.print("Open State Button HIGH - Finished Opening Garage Door")    ;
  Serial.println(""); 
  } 

if (CloseButtonState == HIGH) {

  Serial.print("Close State Button HIGH - Closing Garage Door") ;
  Serial.println(""); 
    // Close Garage Door  
  R2ON(); //turn on relay
  doorstate = 0;
  Serial.print("Relay 2 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R2OFF(); //turn off relay
  Serial.print("Relay 2 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
    Serial.print("Close State Button HIGH - Finished Closing Garage Door")    ;
  Serial.println("");

  } 

if (StopButtonState == HIGH) {

 Serial.print("Stop State Button HIGH - Stopping Garage Door")  ;
 Serial.println("");   
 // Stop
  R3ON(); //turn on relay
  doorstate = 1;
  Serial.print("Relay 3 on") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
  R3OFF(); //turn off relay
  Serial.print("Relay 3 off") ;
  Serial.println(""); 
  delay(1000); // wait 1 second
      Serial.print("Stop State Button HIGH - Finished Stopping Garage Door")    ;
  Serial.println("");

  } 


  // And repeat!
}

void R1ON() {

    digitalWrite(re1, LOW); //turn on relay
    //Particle.publish("Relay 1 on - Door Open");
    delay(1000); // wait 1 second
    digitalWrite(re1, HIGH); //turn off relay
    //Particle.publish("Relay 1 off");

}

void R1OFF() {
  digitalWrite(re1, HIGH); //turn off relay
    //delay(1000); // wait 1 second


}

void R2ON() {

    digitalWrite(re2, LOW); //turn on relay
    //Particle.publish("Relay 2 on - Door Closing");
    delay(1000); // wait 1 second
    digitalWrite(re2, HIGH); //turn off relay
    //Particle.publish("Relay 2 off");

}

void R2OFF() {

    digitalWrite(re2, HIGH); //turn on relay
    //delay(1000); // wait 1 second

}

void R3ON() {

    digitalWrite(re3, LOW); //turn on relay
    //Particle.publish("Relay 3 on - Door Stopped");
    delay(1000); // wait 1 second
    digitalWrite(re3, HIGH); //turn off relay
    //Particle.publish("Relay 3 off");

}

void R3OFF() {

    digitalWrite(re3, HIGH); //turn on relay
    //delay(1000); // wait 1 second

}

void R4ON() {

    digitalWrite(re4, LOW); //turn on relay
    //delay(1000); // wait 1 second

}

void R4OFF() {

    digitalWrite(re4, HIGH); //turn on relay
    //delay(1000); // wait 1 second

}
</code></pre>
 20245: <p>Consider removing the type <a href="https://www.arduino.cc/reference/en/language/variables/data-types/stringobject/" rel="nofollow noreferrer">String</a> from the code including removing where String is used in passing formal values to some functions.  It appears to do nothing.  And if the compiler does not optimize it out, could actually be consuming what little RAM the embedded processor contains. </p>

<p>The type String loads in all kinds of help you may or may not need.  Generally String is a bad idea for embedded processors because Sting consumes a large amount of resources to support all of String's features. And sometimes those resources are not given back.  This is generally referred to as a <a href="https://en.wikipedia.org/wiki/Memory_leak" rel="nofollow noreferrer">memory leak</a>. Briefly, this is when the RAM in an embedded processor is considered used by the program, but is not actually being used by the programmer.  </p>
 57952: <p>In 50+ years of dealing with hardware/software issues, I've found that the culprit is almost never the hardware. So, your problem is most likely the software.</p>

<p>To start with, there are several major problems with your code:</p>

<ol>
<li>You are using an unsigned char type to represent integer values > 256; this will not work.  When I tried to compile your code, one of the many error messages was "StackOvrFl.ino: 107:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]" on the line 'str[1] = 0x4400;' You need to declare 'str' as 'unsigned int str[MAX_LEN];'.</li>
<li>It's really bad form to use 'nicknames' ('uchar') for types; If someone else needs to maintain or modify your code (or help you with it as in this case), they are going to trip over that and emit 4-letter words in your direction.</li>
<li>Turn on compiler warnings and errors, and don't stop debugging until all such warnings/errors are cleared.  The compiler is your friend; let it help you.</li>
<li>If you had turned on compiler warnings/errors, you would have found that the identifier 'MI_OK' was never declared, and so can have ANY VALUE when you check it.</li>
</ol>

<p>The combination of the integer overflow and undeclared symbol problems will almost undoubtedly cause undefined behavior, but there may be other issues as well.  Clean up your code, pay attention to compiler warnings, and then see what happens.</p>

<p>Good luck!</p>

<p>Frank</p>
