You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/examples.md
+51-1Lines changed: 51 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,12 @@ Since this library supports both the M6E Nano and M7E Hecto, you'll need to defi
50
50
51
51
The first example sets the M7E to constantly scan and report any tags it sees in the vicinity. Open the example by navigating to **File > Examples > SparkFun Simultaneous RFID Reader Library > Example 1 Constant Read**. Select your Board and Port and click the "Upload" button. Once the code finishes uploading, open the [serial monitor](https://learn.sparkfun.com/tutorials/terminal-basics/arduino-serial-monitor-windows-mac-linux) with the baud set to **115200**.
The code attempts to set up the module with the defined baud rate andif that fails, it prints "Module failed to respond. Please check wiring" If you see this prompt, double-check your connections to your development board and retry. On successful module startup and setup, the code prints "Press a key to begin scanning for tags." Send any key message and the M7E will begin to scan for any tags in range and print out their EPC as the screenshot below shows:
54
60
55
61
<figure markdown>
@@ -60,6 +66,12 @@ The code attempts to set up the module with the defined baud rate and if that fa
60
66
61
67
The second example demonstrates how to perform a single-shot read of one tag in the reader's range and print out the EPC value over serial. This example uses the `.readTagEPC()` function to pass it an array of bytes (in almost all cases EPCs are 12 bytes), the size of the array (12), and the amount of time to scan before giving up (500ms is default). This returns **RESPONSE_SUCCESS** when the M7E detects a tag and stores the EPC in the array given.
[{ width="600"}](./assets/img/Example2-Read_Single.jpg"Click to enlarge")
65
77
</figure>
@@ -70,6 +82,12 @@ Note, this example also includes definitions and code to set up and use the buzz
70
82
71
83
Example 3 shows how to write a character string and store it as a custom EPC value. This is a great way to keep track of which tag is which by setting the EPC to something like `WRENCH` or `PILL#317`. Note, EPCs can only be written in an even number of bytes like the example sets it to:
Example 5 demonstrates how to edit a tag's user data through the `.writeUserData()` function. This function lets you pass an array of characters to the function and records it to the first tag detected by the reader.
char testData[] = "ACBD"; //Must be even number of bytes. "Hello" is recorded as "Hell".
92
122
byte responseType = nano.writeUserData(testData, sizeof(testData) - 1); //The -1 shaves off the \0 found at the end of string
@@ -104,11 +134,25 @@ The next three examples all deal with passwords to lock a tag with an Access Pas
104
134
105
135
**Example 6 - Read Passwords** displays the Access and Kill passwords for a tag detected by the reader. The Access password allows a user to lock a tag, preventing modification of various parts of the memory (EPC, User, etc). The Kill password is needed to disable a tag. Both passwords are `0x00000000` by default.
[{ width="600"}](./assets/img/Example6-Read_PWs.jpg"Click to enlarge")
109
145
</figure>
110
146
111
-
**Example 7 - Write Passwords** shows you how to write new passwords for both Access and Kill. These values can be adjusted from the passwords set in the example by changing the following lines for myKillPW and myAccessPW:
147
+
**Example 7 - Write Passwords** shows you how to write new passwords for both Access and Kill.
It is very good to see that the protocol has the kill feature. Killing a tag makes sense after an item has been purchased (gallon of milk) or a process has been completed (dry cleaning has been picked up). By limiting the life-span of a tag you can help protect end user privacy and tracking.
132
182
133
183
The Gen2 protocol is well written and prevents a user from walking into a Wal-Mart and blasting away all the tags that haven't been configured. The default Kill password is all 0s but any tag will ignore the kill command with the password set to 0s. Therefore, you must first write a non-zero kill password (using Example7) then you must issue the kill command using the new password.
0 commit comments