Hallo,
Ich habe hier ein Arduino Uno Board mit einem Sparkfun RFID Eval 13.56MHz shield. Das Problem mit
dem Beispielcode habe ich bereits gelöst. Aber leider erkennt der Leser keine Tags. Hiermal mein Code(entwickelt aus dem Beispielcode von Sparkfun):
/*
RFID Eval 13.56MHz Shield example sketch v10
Aaron Weiss, aaron at sparkfun dot com
OSHW license: http://freedomdefined.org/OSHW
works with 13.56MHz MiFare 1k tags
Based on hardware v13:
D7 -> RFID RX
D8 -> RFID TX
D9 -> XBee TX
D10 -> XBee RX
Note: RFID Reset attached to D13 (aka status LED)
Note: be sure include the NewSoftSerial lib, http://arduiniana.org/libraries/newsoftserial/
Usage: Sketch prints 'Start' and waits for a tag. When a tag is in range, the shield reads the tag,
blinks the 'Found' LED and prints the serial number of the tag to the serial port
and the XBee port.
*/
#include <SoftwareSerial.h>
SoftwareSerial rfid(7, 8);
//Prototypes
void halt(void);
void sek(void);
void select();
//Global var
int flag = 0;
int Str1[11];
char s;
//INIT
void setup()
{
Serial.begin(9600);
Serial.println("Start");
// set the data rate for the NewSoftSerial ports
rfid.begin(19200);
delay(100);
}
//MAIN
void loop()
{
if(rfid.available()){
Serial.println();
while(rfid.available()){
Serial.print(rfid.read(), HEX);
Serial.print(" ");
}
}
if(Serial.available()){
s = Serial.read();
Serial.println(s);
}
if(s == 'S')
sek();
if(s == 'H')
halt();
if(s == 'G')
select();
s = 0;
}
void halt()
{
//Halt tag
rfid.write(0xFF);
rfid.write((byte)0x00);
rfid.write(0x01);
rfid.write(0x80);
rfid.write(0x81);
}
void sek()
{
//search for RFID tag
rfid.write(0xFF);
rfid.write((byte)0x00);
rfid.write(0x01);
rfid.write(0x82);
rfid.write(0x83);
}
void select()
{
//search for RFID tag
rfid.write(0xFF);
rfid.write((byte)0x00);
rfid.write(0x01);
rfid.write(0x83);
rfid.write(0x84);
}
Ich kriege auf allen Befehle die richtige Antwort zurück. Allerdings erkennt er die Tags nicht.
Woran könnte sowas liegen?
mfg
Stefan V.