nortski
Posts: 6
Joined: Tue Mar 20, 2018 10:56 pm

Implement cooldown delay for RFID reader

Sun Mar 25, 2018 10:12 am

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?

User avatar
rpdom
Posts: 17275
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Implement cooldown delay for RFID reader

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.

nortski
Posts: 6
Joined: Tue Mar 20, 2018 10:56 pm

Re: Implement cooldown delay for RFID reader

Sun Mar 25, 2018 11:05 am

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!

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Implement cooldown delay for RFID reader

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.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

nortski
Posts: 6
Joined: Tue Mar 20, 2018 10:56 pm

Re: Implement cooldown delay for RFID reader

Wed Mar 28, 2018 7:36 pm

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

Return to “Beginners”