RFID and Button for controlling a relay

Hey guys, so this is a question that has a few answers I believe. So I have one output (a relay) that controls a solenoid. Now, I would to be able to control the relay with both a touch capacitor (TTP223B) and an RFID chip (RC522). I have my software se up where the RFID chip can unlock the door, then re-lock after a period of time, however, I do not know where to implement the touch sensor so it can do the same. (Both RFID and Touch sensor to control the same relay that unlocks the door).

Newbie needs to read the forum guide in the sticky post. All of it :slight_smile:

Good idea to give your post a title that indicates what you want help with.

This saves those who cannot help you with the particular subject from wasting thier time reading the post.

And those that might be experts in your subject will probably not bother to read your post at all.

I do not know where to implement the touch sensor so it can do the same

Somewhere in the loop() function of the code you didn't post.

[quote author=AWOL date=1539196157 link=msg=3901962]
Somewhere in the loop() function of the code you didn't post.
[/quote]

void loop() {
delay(500);
do {
  successRead = getID();  // sets successRead to 1 when we get read from reader otherwise 0
  if (programMode) {
    cycleLeds();              // Program Mode cycles through RGB waiting to read a new card
  }
  else {
    normalModeOn();       // Normal mode, blue Power LED is on, all others are off
  }
}
while (!successRead);     //the program will not go further while you not get a successful read
if (programMode) {
  if ( isMaster(readCard) ) { //If master card scanned again exit program mode
    Serial.println(F("Master Card Scanned"));
    Serial.println(F("Exiting Programming Mode"));
    Serial.println(F("-----------------------------"));
    programMode = false;
    return;
  }
  else {
    if ( findID(readCard) ) { // If scanned card is known delete it
      Serial.println(F("I know this key, removing..."));
      deleteID(readCard);
      Serial.println("-----------------------------");
    }
    else {                    // If scanned card is not known add it
      Serial.println(F("I do not know this key, adding..."));
      writeID(readCard);
      Serial.println(F("-----------------------------"));
    }
  }
}
else {
  if ( isMaster(readCard) ) {     // If scanned card's ID matches Master Card's ID enter program mode
    programMode = true;
    Serial.println(F("Hello Master - Entered Programming Mode"));
    int count = EEPROM.read(0);   // Read the first Byte of EEPROM that
    Serial.print(F("I have "));       // stores the number of ID's in EEPROM
    Serial.print(count);
    Serial.print(F(" record(s) in DATABASE"));
    Serial.println("");
    Serial.println(F("Scan a Card or key to ADD or REMOVE"));
    Serial.println(F("-----------------------------"));
  }
  else {
    if ( findID(readCard) ) { // If not, see if the card is in the EEPROM
      Serial.println(F("Welcome, Acces Granted"));
      granted(300);           // Open the door lock for 300 ms
    }
    else {            // If not, show that the ID was not valid
      Serial.println(F("Acces Denied!"));
      denied();
    }
  }
}
}

...all of the code. In code tags.

AWOL:
...all of the code. In code tags.

Whoops my bad thought I added them

I tried to compile your code.
It didn't go well.

I'll check again again tomorrow. (hint)

AWOL:
I tried to compile your code.
It didn't go well.

I'll check again again tomorrow. (hint)

Ah I got it working with a few minor tweaks here and there, thank you for your time!