Đang chuẩn bị liên kết để tải về tài liệu:
Practical Arduino Cool Projects for Open Source Hardware- P32
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Practical Arduino Cool Projects for Open Source Hardware- P32: A schematic or circuit diagram is a diagram that describes the interconnections in an electrical or electronic device. In the projects presented in Practical Arduino, we’ve taken the approach of providing both a photograph and/or line drawing of the completed device along with a schematic. While learning to read schematics takes a modest investment of your time, it will prove useful time and time again as you develop your projects. With that in mind, we present a quick how-to in this section | CHAPTER 14 RFID ACCESS CONTROL SYSTEM tempByte val The sketch then increments the counter that tracks how many bytes have been read and reaches the end of the loop going back to the start to check if it has finished reading all the digits yet. bytesRead The sketch checks if 12 bytes have been read indicating that it has a complete read and can move on to comparing the acquired value with its list of authorized tags. if bytesRead 12 The tagValue array of characters now contains a sequence of 10 characters in elements 0 through 9 but we need to make sure it s null-terminated so that the sketch can treat it as a string and know where the string ends. We therefore populate the eleventh element element 10 with the null character. tagValue 10 0 To provide feedback for testing or long-term data logging the sketch then uses the serial connection to send status information back to the host so you can use the serial monitor in the Arduino IDE to watch what happens when known and unknown tags are read. Serial.print Tag value Serial.println tagValue It also prints out the checksum that was calculated for this tag and compares it to the value supplied by the tag reader to see if they match. The result is also sent to the host. Serial.print Checksum Serial.print tagBytes 5 HEX Serial.println tagBytes 5 checksum -- passed. -- error. If all you wanted to do was read tags and display their values the loop could end right here but instead the sketch goes on to search its internal tag database for this particular tag to see if it can be identified. Searching the tag database is done using the findTag function that will be explained in a moment. At this point all you need to know is that findTag will return an integer value greater than 1 if the tag was found or 0 if it wasn t found. int tagId findTag tagValue We only want the door to unlock if the scanned tag was found in the database so the sketch checks whether the previous function returned a value greater than 0. If so it sends .