Skip to content

Instantly share code, notes, and snippets.

/comment.c Secret
Created Jul 22, 2016

Embed
What would you like to do?
}
else
{
// Looks like the serial data starts with a valid Start of Text character,
// let mark that we detected a potential tag.
tagDetected = true;
// Go and process the tag in the serial1 buffer.
fetchTagData(ourTag);
// NOTE: The fetchTagData function actually alters the ourTag array
// declared earlier before. Nothing is returned because if an array's name
// pass along into a function, it is actually passing by reference, not by
// value. That means we are changing the array's contents in the function
// so nothing needs to be returned! There are other spots in this program
// where this happens so please keep this in mind.
// While we're at it, why not print out the tag's ID.
Serial.print("Your tag says it is: ");
Serial.flush();
printTag(ourTag);
}
Now, see if you think this format might be easier to read:
} else {
// Looks like the serial data starts with a valid Start of Text character
tagDetected = true; // Flag that we detected a potential tag.
fetchTagData(ourTag); // Go and process the tag in the serial1 buffer.
/*
NOTE: The fetchTagData function actually alters the ourTag array
declared earlier before. Nothing is returned because if an array's name
pass along into a function, it is actually passing by reference, not by
value. That means we are changing the array's contents in the function
so nothing needs to be returned! There are other spots in this program
where this happens so please keep this in mind.
*/
Serial.print("Your tag says it is: "); // While we're at it, why not print out the tag's ID.
Serial.flush();
printTag(ourTag);
}
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.