Skip to content

Instantly share code, notes, and snippets.

/comment.c Secret

Created July 22, 2016 00:12
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 anonymous/301c8ccb12d92cddfa11d8d93e784937 to your computer and use it in GitHub Desktop.
Save anonymous/301c8ccb12d92cddfa11d8d93e784937 to your computer and use it in GitHub Desktop.
}
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