Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SebMadgwick committed Mar 6, 2013
0 parents commit c836b53
Show file tree
Hide file tree
Showing 4 changed files with 336 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
163 changes: 163 additions & 0 deletions .gitignore
@@ -0,0 +1,163 @@
#################
## Eclipse
#################

*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath


#################
## Visual Studio
#################

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover

## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp

# ReSharper is a .NET coding add-in
_ReSharper*

# Installshield output folder
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML



############
## Windows
############

# Windows image file caches
Thumbs.db

# Folder config file
Desktop.ini


#############
## Python
#############

*.py[co]

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox

#Translations
*.mo

#Mr Developer
.mr.developer.cfg

# Mac crap
.DS_Store
3 changes: 3 additions & 0 deletions README.md
@@ -0,0 +1,3 @@
Test sketch for Sparkfun's RFID Evaluation Shield - 13.56MHz (https://www.sparkfun.com/products/10406).

Minor modifications to Aaron Weiss's original code (http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/ID/RFID_Eval_13_56MHz_v10.pde) to enable compatibility with Arduino 1.0 which now incorporates an implementation of NewSoftSerial.
148 changes: 148 additions & 0 deletions RFID_Eval_13_56MHz.ino
@@ -0,0 +1,148 @@
/*
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 SoftwareSerial 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.
06/04/2013 - Modified for compatibility with Arudino 1.0. Seb Madgwick.
*/
#include <SoftwareSerial.h>

SoftwareSerial rfid(7, 8);
SoftwareSerial xbee(10, 9);

//Prototypes
void check_for_notag(void);
void halt(void);
void parse(void);
void print_serial(void);
void read_serial(void);
void seek(void);
void set_flag(void);

//Global var
int flag = 0;
int Str1[11];

//INIT
void setup()
{
Serial.begin(9600);
Serial.println("Start");

// set the data rate for the SoftwareSerial ports
xbee.begin(9600);
rfid.begin(19200);
delay(10);
halt();
}

//MAIN
void loop()
{
read_serial();
}

void check_for_notag()
{
seek();
delay(10);
parse();
set_flag();

if(flag = 1){
seek();
delay(10);
parse();
}
}

void halt()
{
//Halt tag
rfid.write((uint8_t)255);
rfid.write((uint8_t)0);
rfid.write((uint8_t)1);
rfid.write((uint8_t)147);
rfid.write((uint8_t)148);
}

void parse()
{
while(rfid.available()){
if(rfid.read() == 255){
for(int i=1;i<11;i++){
Str1[i]= rfid.read();
}
}
}
}

void print_serial()
{
if(flag == 1){
//print to serial port
Serial.print(Str1[8], HEX);
Serial.print(Str1[7], HEX);
Serial.print(Str1[6], HEX);
Serial.print(Str1[5], HEX);
Serial.println();
//print to XBee module
xbee.print(Str1[8], HEX);
xbee.print(Str1[7], HEX);
xbee.print(Str1[6], HEX);
xbee.print(Str1[5], HEX);
xbee.println();
delay(100);
//check_for_notag();
}
}

void read_serial()
{
seek();
delay(10);
parse();
set_flag();
print_serial();
delay(100);
}

void seek()
{
//search for RFID tag
rfid.write((uint8_t)255);
rfid.write((uint8_t)0);
rfid.write((uint8_t)1);
rfid.write((uint8_t)130);
rfid.write((uint8_t)131);
delay(10);
}

void set_flag()
{
if(Str1[2] == 6){
flag++;
}
if(Str1[2] == 2){
flag = 0;
}
}

0 comments on commit c836b53

Please sign in to comment.