Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!




Windows - Arduino S...
 
Share:
Notifications
Clear all

Windows - Arduino Solenoid Lock using FingerPrint with CoinCounter

Page 3 / 5

(@kalilinux25)
Eminent Member
Joined: 8 months ago
Posts: 41
Topic starter  

@hans I already fix the issue beacuse what us said

check the functions.

check the flowchar

check the brackets

cehck all declaration of what you use as a function

then the declaration must be before the setup or loop

 

THANKS

im very will learning here.

 

FULL CODE

 

#include <PinChangeInterrupt.h>
#include <Adafruit_Fingerprint.h>    //Libraries needed
#include <SoftwareSerial.h>

#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
#define coinSlot 9 // coinslot 5v to 0v if coin passes on the sensor
#define I2C_ADDR 0x27          //LCD i2c stuff
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

int relayPin = 4;

String Names[] = { "RAVEN", "Surtr", "Tech",}; //Those are the names affected to the fingertemplates IDs
//The first on which is Names[0] : "" has the ID 1 in the fingerprint sensor

SoftwareSerial mySerial(2, 3);                  //Fingerprint sensor wiring RX 3, TX 2
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin); //LCD declaring

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);                    //Fingerprint sensor declaring

volatile int coinCount = 0;
int requiredCoins = 1;
boolean coinInserted = false;
int coinSlotSignal;
void setup()
{
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, HIGH);
  pinMode(coinSlot, INPUT_PULLUP);
  lcd.write(EEPROM.read(5));
  Serial.begin(9600);
  attachPinChangeInterrupt(digitalPinToPinChangeInterrupt(9), coinInterrupt, FALLING);
  finger.begin(57600);              //Sensor baude rate
  lcd.begin (16, 2);
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.setCursor(0, 0);
  lcd.print("SECURED VAULT");
  lcd.home();
  finger.getTemplateCount();        //Counts the number of templates stored in the sensor flash memory
  delay(2000);
}

void loop() {
  int FingerPrintResult = getFingerprintIDez();


  if (FingerPrintResult != -1) { //This function keeps looping and waiting for a fingerprint to be put on the sensor
    OpenDoor();
  }
  else
  {
    coinSlotSignal = digitalRead(coinSlot);

    if (coinInserted) {
      coinInserted = false;
      coinCount++;

      EEPROM.write(0, coinCount);
      Serial.println(EEPROM.read(0));

      lcd.setCursor(0, 0);
      lcd.print("TOTAL:");
      lcd.setCursor(0, 1);
      lcd.print(coinCount);
    }
    }
  }
  void coinInterrupt() {
      coinCount++ ;
      coinInserted = true;
}
//Only the modifications are commented
int getFingerprintIDez() {
  uint8_t p = finger.getImage();        //Image scanning
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.image2Tz();               //Converting
  if (p != FINGERPRINT_OK)  return -1;

  lcd.clear();                     //And here we write a message or take an action for the denied template
  p = finger.fingerFastSearch();     //Looking for matches in the internal memory
  if (p != FINGERPRINT_OK) {         //if the searching fails it means that the template isn't registered
    lcd.print("Access denied");
    delay(2000);
    return -1;
  }
  //If we found a match we proceed in the function

  lcd.print("Welcome");                  //Printing a message for the recognized template
  lcd.setCursor(2, 1);
  lcd.print(Names[finger.fingerID - 1]); //Then print the name we gave it and the -1 is to remove the shift as the ID starts from "1" but the array from "0"
  return finger.fingerID;
}
void OpenDoor() {
  digitalWrite(relayPin, LOW); // turn on solenoidlock
  delay(5000);
  digitalWrite(relayPin, HIGH); // turn off solenoidlock
}

But I have this this error code'

 

Arduino: 1.8.14 (Windows 10), Board: "Arduino Uno"





















libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial

(.text+0x0): multiple definition of `__vector_3'

PinChangeInterrupt0.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

Multiple libraries were found for "PinChangeInterrupt.h"

 Used: C:\Users\asus\Documents\Arduino\libraries\PinChangeInterrupt

 Not used: C:\Users\asus\Documents\Arduino\libraries\PinChangeInterrupt-master

Multiple libraries were found for "Adafruit_Fingerprint.h"

 Used: C:\Users\asus\Documents\Arduino\libraries\Adafruit_Fingerprint_Sensor_Library

 Not used: C:\Users\asus\Documents\Arduino\libraries\fing

exit status 1

Error compiling for board Arduino Uno.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

ReplyQuote
 Hans
(@hans)
Prominent Member Admin
Joined: 9 years ago
Posts: 996
 

You can define that function at the end of the code.

As for the error message: it looks like you have duplicate libraries installed and the compiler doesn't know which one to use.

By the looks of it:

C:\Users\asus\Documents\Arduino\libraries\PinChangeInterrupt
and
C:\Users\asus\Documents\Arduino\libraries\PinChangeInterrupt-master  (remove this one)

and 

C:\Users\asus\Documents\Arduino\libraries\Adafruit_Fingerprint_Sensor_Library
and
C:\Users\asus\Documents\Arduino\libraries\fing (remove this one)

 

Technically this doesn't break compiling, but I think it may cause the first error message - I could be wrong though.
Best to move those directories temporary to a different location, for example your desktop.


ReplyQuote
(@kalilinux25)
Eminent Member
Joined: 8 months ago
Posts: 41
Topic starter  

@hans Thanks sir libraries was deleted 

only error 

was this 

 

libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial
(.text+0x0): multiple definition of `__vector_3'
PinChangeInterrupt0.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Uno.

ReplyQuote
 Hans
(@hans)
Prominent Member Admin
Joined: 9 years ago
Posts: 996
 

I'm afraid that is an error with one of the libraries you're using (PinChangeInterrupt probably).
I'm not familiar what this library is for though?

If it is for setting an interrupt for the coinslot, then you would not really need a library for that.
Read this paragraph on my All-in-One LED effects - it shows how I set an interrupt without the need of a library.
The AttchInterrupt() Arduino Documentation is a good source as well.

The pin needs to be a digital pin of course, so I hope you still have one available.

Seeing that you're using pin 9 for the coinslot (which on the Uno is a digital pin), you should be fine ...


ReplyQuote
(@kalilinux25)
Eminent Member
Joined: 8 months ago
Posts: 41
Topic starter  

@hans I use this library sir https://github.com/NicoHood/PinChangeInterrupt its used to allow pin 9 to be used in the interrupt


ReplyQuote


 Hans
(@hans)
Prominent Member Admin
Joined: 9 years ago
Posts: 996
 

As far as I can see ... you wouldn't need that?

See also the Arduino Documentation and met All-in-One LED effects.
Pin 2 and 3 can be used directly on an Arduino Uno.
The other pins are done like so (no library needed):

Example from the documentation:

const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}

void loop() {
  digitalWrite(ledPin, state);
}

void blink() {
  state = !state;
}

 

So in your code, with the attach interrupt line:

pinMode(coinSlot, INPUT_PULLUP);
...
attachPinChangeInterrupt(digitalPinToPinChangeInterrupt(9), coinInterrupt, FALLING);

 

should be replaced with:

pinMode(coinSlot, INPUT_PULLUP);
...
attachInterrupt(digitalPinToInterrupt(coinSlot), coinInterrupt, FALLING);

 

Note: you can consider using "CHANGE" instead of "FALLING" - in my experience "CHANGE" is more reliable, but you do have to check the button state.

void coinInterrupt() {
  if (digitalRead (coinSlot) == HIGH) {
    coinCount++ ;
    coinInserted = true;
  }
}

 

(again: you will have to work more consistent in your code. Using a hardcoded "9" and defining "coinSlot" as 9 for the same pin, is a recipe for confusion)

You can then remove this line then as well (load library):

#include <PinChangeInterrupt.h>

ReplyQuote
(@kalilinux25)
Eminent Member
Joined: 8 months ago
Posts: 41
Topic starter  

@hans

#include <Adafruit_Fingerprint.h>    //Libraries needed
#include <SoftwareSerial.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
#define coinSlot 9 // coinslot 5v to 0v if coin passes on the sensor
#define I2C_ADDR 0x27          //LCD i2c stuff
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

int relayPin = 4;

String Names[] = { "RAVEN", "Surtr", "Tech",}; //Those are the names affected to the fingertemplates IDs
//The first on which is Names[0] : "" has the ID 1 in the fingerprint sensor

SoftwareSerial mySerial(2, 3);                  //Fingerprint sensor wiring RX 3, TX 2
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin); //LCD declaring

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);                    //Fingerprint sensor declaring

volatile int coinCount = 0;
int requiredCoins = 1;
boolean coinInserted = false;
int coinSlotSignal;
void setup()
{
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, HIGH);
  pinMode(coinSlot, INPUT_PULLUP);
  lcd.write(EEPROM.read(5));
  Serial.begin(9600);
  attachInterrupt(digitalPinToInterrupt(9), coinInterrupt, FALLING);
  finger.begin(57600);              //Sensor baude rate
  lcd.begin (16, 2);
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.setCursor(0, 0);
  lcd.print("SECURED VAULT");
  lcd.home();
  finger.getTemplateCount();        //Counts the number of templates stored in the sensor flash memory
  delay(2000);
}

void loop() {
  int FingerPrintResult = getFingerprintIDez();


  if (FingerPrintResult != -1) { //This function keeps looping and waiting for a fingerprint to be put on the sensor
    OpenDoor();
  }
  else
  {
    coinSlotSignal = digitalRead(coinSlot);

    if (coinInserted) {
      coinInserted = false;
      coinCount++;

      EEPROM.write(0, coinCount);
      Serial.println(EEPROM.read(0));

      lcd.setCursor(0, 0);
      lcd.print("TOTAL:");
      lcd.setCursor(0, 1);
      lcd.print(coinCount);
    }
    }
  }
  void coinInterrupt() {
      coinCount++ ;
      coinInserted = true;
}
//Only the modifications are commented
int getFingerprintIDez() {
  uint8_t p = finger.getImage();        //Image scanning
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.image2Tz();               //Converting
  if (p != FINGERPRINT_OK)  return -1;

  lcd.clear();                     //And here we write a message or take an action for the denied template
  p = finger.fingerFastSearch();     //Looking for matches in the internal memory
  if (p != FINGERPRINT_OK) {         //if the searching fails it means that the template isn't registered
    lcd.print("Access denied");
    delay(2000);
    return -1;
  }
  //If we found a match we proceed in the function

  lcd.print("Welcome");                  //Printing a message for the recognized template
  lcd.setCursor(2, 1);
  lcd.print(Names[finger.fingerID - 1]); //Then print the name we gave it and the -1 is to remove the shift as the ID starts from "1" but the array from "0"
  return finger.fingerID;
}
void OpenDoor() {
  digitalWrite(relayPin, LOW); // turn on solenoidlock
  delay(5000);
  digitalWrite(relayPin, HIGH); // turn off solenoidlock
}

 

 

There is no error code now BUT the coin sensor wont detect the coin now. Then If I tried to input fingerprint the "WELCOME" will not disappear in the screen

I trried to look on your https://www.tweaking4all.com/hardware/arduino/arduino-all-ledstrip-effects-in-one/#Challenge2Catchingthatbutton but it got me so confused , sorry . I only I understand that if your using the attach interrupt t must alwasy have outside declarion but not insidethe loop also.


ReplyQuote
 Hans
(@hans)
Prominent Member Admin
Joined: 9 years ago
Posts: 996
 

Can you try:

attachInterrupt(digitalPinToInterrupt(9), coinInterrupt, CHANGE);

ReplyQuote
(@kalilinux25)
Eminent Member
Joined: 8 months ago
Posts: 41
Topic starter  

@hans I tried LOW,HIGH,CHANGE,FALLING nothing change , I also tried to check again the code that need a library which is the

attachPinChangeInterrupt(digitalPinToPinChangeInterrupt(9), coinInterrupt, FALLING);

 

Then I tried to remove the fingerprint codes and try to test it in software serial

serial.print(coinslot);

 

this was the code without the other codes

#include <PinChangeInterrupt.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
#define coinSlot 9 // coinslot 5v to 0v if coin passes on the sensor
#define I2C_ADDR 0x27          //LCD i2c stuff
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

int relayPin = 4;

String Names[] = { "RAVEN", "Surtr", "Tech",}; //Those are the names affected to the fingertemplates IDs
//The first on which is Names[0] : "" has the ID 1 in the fingerprint sensor            //Fingerprint sensor wiring RX 3, TX 2
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin); //LCD declaring
                    //Fingerprint sensor declaring

volatile int coinCount = 0;
int requiredCoins = 1;
boolean coinInserted = false;
int coinSlotSignal;
void setup()
{
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, HIGH);
  pinMode(coinSlot, INPUT_PULLUP);
  lcd.write(EEPROM.read(5));
  Serial.begin(9600);
  attachPinChangeInterrupt(digitalPinToPinChangeInterrupt(9), coinInterrupt, FALLING);
  Serial.print(coinSlot);         //Sensor baude rate
  lcd.begin (16, 2);
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.setCursor(0, 0);
  lcd.print("SECURED VAULT");
  lcd.home();
}
  void coinInterrupt() {
      coinCount++ ;
      coinInserted = true;
}

void loop() {
  
    coinSlotSignal = digitalRead(coinSlot);

    if (coinInserted) {
      coinInserted = false;
   

      EEPROM.write(0, coinCount);
      Serial.println(EEPROM.read(0));

      lcd.setCursor(0, 0);
      lcd.print("TOTAL:");
      lcd.setCursor(0, 1);
      lcd.print(coinCount);
    }
    }

ReplyQuote
 Hans
(@hans)
Prominent Member Admin
Joined: 9 years ago
Posts: 996
 

In my code I used pin 2 (LED effects code) and did not need to use the digitalPinToInterrupt() function.

Maybe it would be a good to briefly test the coinslot part in a new sketch - just to test and see if the other libraries are not interfering.
I know it is frustrating; as I mentioned before: trying to do everything at once is usually a recipe for confusion.


ReplyQuote


(@kalilinux25)
Eminent Member
Joined: 8 months ago
Posts: 41
Topic starter  

@hans ok sir Ill update you for a while ILL try it


ReplyQuote
(@kalilinux25)
Eminent Member
Joined: 8 months ago
Posts: 41
Topic starter  

I tried to change the

attachPinChangeInterrupt(digitalPinToPinChangeInterrupt(9), coinInterrupt, FALLING);

 

to 

attachInterrupt(digitalPinToInterrupt(9), coinInterrupt, FALLING);

 

but nothing happens in the serial monitor

 

 I tried to use this code to test

#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
#define coinSlot 9 // coinslot 5v to 0v if coin passes on the sensor
#define I2C_ADDR 0x27          //LCD i2c stuff
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

int relayPin = 4;

String Names[] = { "RAVEN", "Surtr", "Tech",}; //Those are the names affected to the fingertemplates IDs
//The first on which is Names[0] : "" has the ID 1 in the fingerprint sensor            //Fingerprint sensor wiring RX 3, TX 2
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin); //LCD declaring
                    //Fingerprint sensor declaring

volatile int coinCount = 0;
int requiredCoins = 1;
boolean coinInserted = false;
int coinSlotSignal;
void setup()
{
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, HIGH);
  pinMode(coinSlot, INPUT_PULLUP);
  lcd.write(EEPROM.read(5));
  Serial.begin(9600);
  attachInterrupt(digitalPinToInterrupt(9), coinInterrupt, FALLING);
  Serial.print(coinSlot);         //Sensor baude rate
  lcd.begin (16, 2);
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.setCursor(0, 0);
  lcd.print("SECURED VAULT");
  lcd.home();
}
  void coinInterrupt() {
      coinCount++ ;
      coinInserted = true;
}

void loop() {
  
    coinSlotSignal = digitalRead(coinSlot);

    if (coinInserted) {
      coinInserted = false;
   

      EEPROM.write(0, coinCount);
      Serial.println(EEPROM.read(0));

      lcd.setCursor(0, 0);
      lcd.print("TOTAL:");
      lcd.setCursor(0, 1);
      lcd.print(coinCount);
    }
    }

ReplyQuote
(@kalilinux25)
Eminent Member
Joined: 8 months ago
Posts: 41
Topic starter  

@hans Its ok sir in return Im having a good experience on this project


ReplyQuote
(@kalilinux25)
Eminent Member
Joined: 8 months ago
Posts: 41
Topic starter  

@hans why those if I tried to add fingerprint the LCD dislay will display the "WELCOME "name" " but it wont dissaper at all

 

I already figured out it sir , your right I don't need the pinchangeint. I jsut nned the attachedint so what I did is I change my serialsoftware pins to ( 0, 2) then used the int pin of 3 in the UNO pins.

 

after that I've noticed that the coins was adding 2 values evrytime the coin was detected so I just remove the line of code here

void loop() {
  int FingerPrintResult = getFingerprintIDez();


  if (FingerPrintResult != -1) { //This function keeps looping and waiting for a fingerprint to be put on the sensor
    OpenDoor();
  }
  else
  {
    coinSlotSignal = digitalRead(coinSlot);

    if (coinInserted) {
      coinInserted = false;
      coinCount++;

      EEPROM.write(0, coinCount);
      Serial.println(EEPROM.read(0));

      lcd.setCursor(0, 0);
      lcd.print("TOTAL:");
      lcd.setCursor(0, 1);
      lcd.print(coinCount);
    }
    }
  }

 

to this

 

void loop() {
  int FingerPrintResult = getFingerprintIDez();


  if (FingerPrintResult != -1) { //This function keeps looping and waiting for a fingerprint to be put on the sensor
    OpenDoor();
  }
  else
  {
    coinSlotSignal = digitalRead(coinSlot);

    if (coinInserted) {
      coinInserted = false;
      
      EEPROM.write(0, coinCount);
      Serial.println(EEPROM.read(0));

      lcd.setCursor(0, 0);
      lcd.print("TOTAL:");
      lcd.setCursor(0, 1);
      lcd.print(coinCount);
    }
    }
  }

 

after that I've fix some codes then this is the full code now

#include <Adafruit_Fingerprint.h>    //Libraries needed
#include <SoftwareSerial.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
#define coinSlot 3 // coinslot 5v to 0v if coin passes on the sensor
#define I2C_ADDR 0x27          //LCD i2c stuff
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

int relayPin = 4;

String Names[] = { "RAVEN", "Surtr", "Tech",}; //Those are the names affected to the fingertemplates IDs
//The first on which is Names[0] : "" has the ID 1 in the fingerprint sensor

SoftwareSerial mySerial(0, 2);                  //Fingerprint sensor wiring RX 3, TX 2
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin); //LCD declaring

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);                    //Fingerprint sensor declaring

volatile int coinCount = 0;
int requiredCoins = 1;
boolean coinInserted = false;
int coinSlotSignal;
void setup()
{
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, HIGH);
  pinMode(coinSlot, INPUT_PULLUP);
  lcd.write(EEPROM.read(5));
  Serial.begin(9600);
  attachInterrupt(digitalPinToInterrupt(3), coinInterrupt, FALLING);
  Serial.print(coinSlot);
  finger.begin(57600);              //Sensor baude rate
  lcd.begin (16, 2);
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home();
  finger.getTemplateCount();        //Counts the number of templates stored in the sensor flash memory
  delay(2000);
}
void coinInterrupt() {
      coinCount++ ;
      coinInserted = true;
}
void loop() {
  int FingerPrintResult = getFingerprintIDez();


  if (FingerPrintResult != -1) { //This function keeps looping and waiting for a fingerprint to be put on the sensor
    OpenDoor();
  }
  else
  {
    coinSlotSignal = digitalRead(coinSlot);

    if (coinInserted) {
      coinInserted = false;
      
      EEPROM.write(0, coinCount);
      Serial.println(EEPROM.read(0));

      lcd.setCursor(0, 0);
      lcd.print("TOTAL:");
      lcd.setCursor(0, 1);
      lcd.print(coinCount);
    }
    }
  }
//Only the modifications are commented
int getFingerprintIDez() {
  uint8_t p = finger.getImage();        //Image scanning
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.image2Tz();               //Converting
  if (p != FINGERPRINT_OK)  return -1;

  lcd.clear();                     //And here we write a message or take an action for the denied template
  p = finger.fingerFastSearch();     //Looking for matches in the internal memory
  if (p != FINGERPRINT_OK) {         //if the searching fails it means that the template isn't registered
    lcd.print("Access denied");
    delay(2000);
    return -1;
  }
  //If we found a match we proceed in the function

  lcd.print("Welcome");                  //Printing a message for the recognized template
  lcd.setCursor(2, 1);
  lcd.print(Names[finger.fingerID - 1]); //Then print the name we gave it and the -1 is to remove the shift as the ID starts from "1" but the array from "0"
  return finger.fingerID;
}
void OpenDoor() {
  digitalWrite(relayPin, LOW); // turn on solenoidlock
  delay(5000);
  digitalWrite(relayPin, HIGH); // turn off solenoidlock
}

 

thanks for advising that I might need to try the coinslot interrupt out from my full code then It was Cleary seen it.

 

but 1 thing how can I solve the display of the welcome it wont go away even I tried to add coin it will missed up the text 


ReplyQuote
(@kalilinux25)
Eminent Member
Joined: 8 months ago
Posts: 41
Topic starter  


ReplyQuote


Page 3 / 5

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: