Skip to content

Instantly share code, notes, and snippets.

@sweemeng
Created January 17, 2012 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sweemeng/1626692 to your computer and use it in GitHub Desktop.
Save sweemeng/1626692 to your computer and use it in GitHub Desktop.
Seeedstudios 125kHz RFID reader Example
void setup(){
Serial.begin(9600);
Serial1.begin(9600);
}
void loop(){
char code[10];
int bytesread = 0;
while(Serial1.available() > 0){
int val = Serial1.read();
if(val == 2){
bytesread = 0;
while(bytesread < 10){
if(Serial1.available() > 0){
val = Serial1.read();
code[bytesread] = val;
bytesread++;
}
}
if(bytesread == 10){
Serial.println(code);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment