/*****************************
RFID
powered
lockbox
This
sketch
will
move
a
servo
when
a
trusted
tag
is
read
with
the
ID
12/ID
20
RFID
module
Pinout
for
SparkFun
RFID
USB
Reader
Arduino
RFID
module
5V
VCC
GND
GND
D2
TX
Pinout
for
SparkFun
RFID
Breakout
Board
Arduino
RFID
module
5V
VCC
GND
GND
D2
D0
Connect
the
servo's
power,
ground,
and
signal
pins
to
VCC,
GND,
and
Arduino
D9
If
using
the
breakout,
you
can
also
put
an
LED
&
330
ohm
resistor
between
the
RFID
module's
READ
pin
and
GND
for
a
"card
successfully
read"
indication
by
acavis,
3/31/2015
Inspired
by
&
partially
adapted
from
http://bildr.org/2011/02/rfid
arduino/
******************************/
#include
<SoftwareSerial.h>
#include
<Servo.h>
//
Choose
two
pins
for
SoftwareSerial
SoftwareSerial
rSerial(2,
3);
//
RX,
TX
//
Make
a
servo
object
Servo
lockServo;
//
Pick
a
PWM
pin
to
put
the
servo
on
const int servoPin
= 9;
//
For
SparkFun's
tags,
we
will
receive
16
bytes
on
every
//
tag
read,
but
throw
four
away.
The
13th
space
will
always
//
be
0,
since
proper
strings
in
Arduino
end
with
0
//
These
constants
hold
the
total
tag
length
(tagLen)
and
//
the
length
of
the
part
we
want
to
keep
(idLen),
//
plus
the
total
number
of
tags
we
want
to
check
against
(kTa
gs)
const int tagLen
= 16;
const int idLen
= 13;
const int kTags
= 4;
//
Put
your
known
tags
here!
char knownTags[kTags][idLen]
= {
"111111111111",
"444444444444",
"555555555555",
Page 7 of 10