Page 1 of 1

Implement cooldown delay for RFID reader

Posted: Sun Mar 25, 2018 10:12 am
by nortski
Hi all,
New to python, new to programming in fact. I'm creating a project that uses RFID cards and a reader to add credit to a video arcade machine.
As it stands, I can read an RFID card and check to see if the card is active of disabled. If active I need a way to allow the same card to be used only once per minute so looking for some kind of cool down function.

I'm using a mysql database to store the card numbers, maybe I need to have a separate column that holds a value for when the card was last used?

Re: Implement cooldown delay for RFID reader

Posted: Sun Mar 25, 2018 10:59 am
by rpdom
nortski wrote:
Sun Mar 25, 2018 10:12 am
I'm using a mysql database to store the card numbers, maybe I need to have a separate column that holds a value for when the card was last used?
That sounds like a good idea, or even store a time one minute later than when the card was last used and check for that when the card is presented again.

Re: Implement cooldown delay for RFID reader

Posted: Sun Mar 25, 2018 11:05 am
by nortski
rpdom wrote:
Sun Mar 25, 2018 10:59 am
nortski wrote:
Sun Mar 25, 2018 10:12 am
I'm using a mysql database to store the card numbers, maybe I need to have a separate column that holds a value for when the card was last used?
That sounds like a good idea, or even store a time one minute later than when the card was last used and check for that when the card is presented again.
Hmm yeh that sounds like a good idea, thanks!

Re: Implement cooldown delay for RFID reader

Posted: Mon Mar 26, 2018 12:26 am
by DougieLawson
In my code, where I'm reading RFID cards with a Wemos, I'm using a 5000 millisecond timer to avoid duplicate reads.

Re: Implement cooldown delay for RFID reader

Posted: Wed Mar 28, 2018 7:36 pm
by nortski
DougieLawson wrote:
Mon Mar 26, 2018 12:26 am
In my code, where I'm reading RFID cards with a Wemos, I'm using a 5000 millisecond timer to avoid duplicate reads.
I used the TIMESTAMPADD to set a time in the future then compare it with the current TIMESTAMP