Im working on my RFID reader.
Right now im using a SerialDataReceivedEventHandler
Foreach all the chars out, stoppen when i reach the end char…
But problem is that the reader will run the event handler alot of times.
And i only want it to read the tag ones, and then have some sort of disabled timer, where it wont read, so it doesnt read the tag multiple times.
Anyone who can help? maybe an example on how a good idea would be to build a class for this?
With a serial port DataReceived event, you have no control about how many times the event handler will be called. You can not expect it to only be called once per RFID tag swipe.
You have to be prepared to receive multiple events, and you have to process the each event until you have assembled an entire RFID messages.
ohh yeah, i know, i just removed some of my testing stuff from the code, before i posted it, forgot to place that one in the right place.
But it reads just fine. only problem is that it does it multiple times…
So its really just how to make sure i only get the tags once, and then wait. for a new.
Cause im going to send the tag’s data over bluetooth, and i dont want it to be spamming out the tag again and again.
I tryed the seeduino driver, but it crashes for some reason when i read a tag, and quits debug aswell with no error…
Thats why i decided to build one myself…
The other ones seems a bit complicated
if it’s reading it multiple times, the “problem” is with the reader not your software. You’re going to have to build app logic to control that yourself. When you hit an end-of-tag you could bubble up an event and only dispatch that over BT if your last send was different and the time was longer than 5 seconds ago.