Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RFID example for CryptoShield
const int TAG_LENGTH = 13;
char tag[TAG_LENGTH + 2];
int index = 0;
void setup(){
Serial.begin(9600);
memset(tag, 0, sizeof(tag));
}
void loop(){
while(Serial.available()){
int readByte = Serial.read();
if (readByte == 0x02){
// Begining byte, just skip it
}
else if (readByte == 0x03)
{
//done reading, 0x03 is the end byte of the tag
delay(10);
Serial.write(tag);
//reset the buffer for the next tag
index = 0;
memset(tag, 0, sizeof(tag));
}
else {
tag[index] = readByte;
index += 1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.