Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: RFID Repeating? on: January 21, 2013, 07:14:00 am
Oh I see what you mean man. Sweet. So I can just remove that while loop and then It should be perfect? smiley-grin
2  Using Arduino / Programming Questions / Re: RFID Repeating? on: January 20, 2013, 07:11:06 pm
I don't think so, cause what I want it to do is, it scans a tag, when it gets a valid code(12 digits) it performs a task. In my code it is the (found) if statement for finding it true that it exists.
Now after that, that while loop happens and cleans up any mess(that buffer/repeating problem I had) so it will clear the RFID buffer? So yes it is data, but it is data I already used. Does it make sense? Do you think there is a better way of doing it?

Thanks
3  Using Arduino / Programming Questions / Re: RFID Repeating? on: January 19, 2013, 10:24:44 am
UKHeliBob yeah isnt that what my while loop was suppose to do? Discarding the buffer.

Grumpy_Mike I think that is what the problem is. Like when I scan the tag it picks it up a few times. Arduino handles the first one with that 3sec delay now after the delay it goes and read again from the RFID(which has the tag id a few more times?)
Then it outputs it like 3 or more times after the tag has been removed.
So it doesnt continuously sends it just 3 or 4 times after the tag has been removed then stops.

But for some mirycal it is working perfectly now havnt had any problems yet.
Thanks
4  Using Arduino / Programming Questions / Re: RFID Repeating? on: January 18, 2013, 06:16:40 am
Oh wow nevermind the problem still occur.

Is it possible to clear to buffer after I got a first reading of my card/tag?
So that it won't keep printing afterwards like pause for 3 seconds and then be able to read cards from scratch and repeat*
5  Using Arduino / Programming Questions / Re: RFID Repeating? on: January 18, 2013, 06:07:19 am
My bad I get now what you meant by the buffer!

The program printed the card/tag a few times after it was removed(still in the buffer i guess?) that was my initial error and I fixed it by adding this while loop at the end!

Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(11, 12);

boolean found=true;
char c;
String msg = "";

void setup() 
{
  Serial.begin(9600);
  Serial.println("Serial Ready");

  mySerial.begin(9600);
  Serial.println("RFID Ready");
}

void loop()
{
  while(mySerial.read() != -1)
  {
   
    while(mySerial.available()>0){
      c=mySerial.read();
      msg += c;
      if(msg.length() == 12)
        break;
    }
   
   
    Serial.println("Gate Open");
    Serial.println("ID: "+msg);
    if(found)
    {
      msg = "";
      delay(3000);
    }
    while(mySerial.read() != -1) {}; //This one to clear the buffer?
  }
}

Many thanks!!
6  Using Arduino / Programming Questions / RFID Repeating? on: January 18, 2013, 04:35:13 am
Hello Arduino world,

I have a RFID reader (http://robotics.org.za/index.php?route=product/product&path=114_96&product_id=243)
and
Arduino UNO R3

I connected it like the following instructable
http://www.instructables.com/id/Arduino-and-RFID-from-seeedstudio/?ALLSTEPS

This is my code
Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(11, 12);

void setup() 
{
  Serial.begin(9600);
  Serial.println("Serial Ready");

  mySerial.begin(9600);
  Serial.println("RFID Ready");
}

void loop()
{
  if(mySerial.available()>0)
    Serial.print("Reading");
}

Now my problem is when I open my Serial Monitor, It gives me Serial Read and RFID Ready.
Thats all good.
Now when I first scan my card/tag I get Reading printed over and over but when I remove my card/tag it still prints Reading? Why is that?
I understand that .available function reads when my card/tag is nearby and should stop reading if my card/tag is removed but I am wrong and I have tried many things now.
Can anyone send me in some new direction to help me out.

Kind Regards
Jaco
Pages: [1]