Merge branch 'master' into upd-readme
This commit is contained in:
@@ -91,7 +91,7 @@ void loop() {
|
||||
Serial.println();
|
||||
|
||||
// Dump PICC type
|
||||
// byte piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
|
||||
// MFRC522::PICC_Type piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
|
||||
// Serial.print(F("PICC type: "));
|
||||
// Serial.print(mfrc522.PICC_GetTypeName(piccType));
|
||||
// Serial.print(F(" (SAK "));
|
||||
|
||||
@@ -78,7 +78,7 @@ void loop() {
|
||||
dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
|
||||
Serial.println();
|
||||
Serial.print(F("PICC type: "));
|
||||
byte piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
|
||||
MFRC522::PICC_Type piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
|
||||
Serial.println(mfrc522.PICC_GetTypeName(piccType));
|
||||
|
||||
// Check for compatibility
|
||||
|
||||
@@ -77,7 +77,7 @@ void loop() {
|
||||
dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
|
||||
Serial.println();
|
||||
Serial.print(F("PICC type: "));
|
||||
byte piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
|
||||
MFRC522::PICC_Type piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
|
||||
Serial.println(mfrc522.PICC_GetTypeName(piccType));
|
||||
|
||||
// Check for compatibility
|
||||
|
||||
@@ -72,7 +72,7 @@ void loop() {
|
||||
dump_byte_array(mfrc522[reader].uid.uidByte, mfrc522[reader].uid.size);
|
||||
Serial.println();
|
||||
Serial.print(F("PICC type: "));
|
||||
byte piccType = mfrc522[reader].PICC_GetType(mfrc522[reader].uid.sak);
|
||||
MFRC522::PICC_Type piccType = mfrc522[reader].PICC_GetType(mfrc522[reader].uid.sak);
|
||||
Serial.println(mfrc522[reader].PICC_GetTypeName(piccType));
|
||||
|
||||
// Halt PICC
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* --------------------------------------------------------------------------------------------------------------------
|
||||
* Example sketch/program to test your firmware.
|
||||
* ----------------------------------------------------------------------------
|
||||
* This is a MFRC522 library example; see https://github.com/miguelbalboa/rfid
|
||||
* for further details and other examples.
|
||||
* --------------------------------------------------------------------------------------------------------------------
|
||||
* This is a MFRC522 library example; for further details and other examples see: https://github.com/miguelbalboa/rfid
|
||||
*
|
||||
* NOTE: The library file MFRC522.h has a lot of useful info. The functions are
|
||||
* documented in MFRC522.cpp. Please read it.
|
||||
* This example test the firmware of your MFRC522 reader module, only known version can be checked. If the test passed
|
||||
* it do not mean that your module is faultless! Some modules have bad or broken antennas or the PICC is broken.
|
||||
*
|
||||
* NOTE: for more informations read the README.rst
|
||||
*
|
||||
* Released into the public domain.
|
||||
*
|
||||
@@ -31,8 +32,11 @@
|
||||
#define RST_PIN 9 // Configurable, see typical pin layout above
|
||||
#define SS_PIN 10 // Configurable, see typical pin layout above
|
||||
|
||||
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
|
||||
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
|
||||
|
||||
/**
|
||||
* Check firmware only once at startup
|
||||
*/
|
||||
void setup() {
|
||||
Serial.begin(9600); // Initialize serial communications with the PC
|
||||
while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
|
||||
@@ -43,8 +47,11 @@ void setup() {
|
||||
Serial.println(F("MFRC522 Digital self test"));
|
||||
Serial.println(F("*****************************"));
|
||||
ShowReaderVersion(); // Show version of PCD - MFRC522 Card Reader
|
||||
Serial.println(F("-----------------------------"));
|
||||
Serial.println(F("Only known versions supported"));
|
||||
Serial.println(F("-----------------------------"));
|
||||
Serial.println(F("Performing test..."));
|
||||
bool result = mfrc522.PCD_PerformSelfTest();
|
||||
bool result = mfrc522.PCD_PerformSelfTest(); // perform the test
|
||||
Serial.println(F("-----------------------------"));
|
||||
Serial.print(F("Result: "));
|
||||
if (result)
|
||||
@@ -64,17 +71,14 @@ void ShowReaderVersion() {
|
||||
byte v = mfrc522.PCD_ReadRegister(mfrc522.VersionReg);
|
||||
Serial.print(F("Firmware Version: 0x"));
|
||||
Serial.print(v, HEX);
|
||||
if (v == 0x88)
|
||||
Serial.print(F(" = (clone)"));
|
||||
else if (v == 0x90)
|
||||
Serial.print(F(" = v0.0"));
|
||||
else if (v == 0x91)
|
||||
Serial.print(F(" = v1.0"));
|
||||
else if (v == 0x92)
|
||||
Serial.print(F(" = v2.0"));
|
||||
else
|
||||
Serial.print(F(" = (unknown)"));
|
||||
Serial.println();
|
||||
// Lookup which version
|
||||
switch(v) {
|
||||
case 0x88: Serial.println(F(" = (clone)")); break;
|
||||
case 0x90: Serial.println(F(" = v0.0")); break;
|
||||
case 0x91: Serial.println(F(" = v1.0")); break;
|
||||
case 0x92: Serial.println(F(" = v2.0")); break;
|
||||
default: Serial.println(F(" = (unknown)"));
|
||||
}
|
||||
// When 0x00 or 0xFF is returned, communication probably failed
|
||||
if ((v == 0x00) || (v == 0xFF))
|
||||
Serial.println(F("WARNING: Communication failure, is the MFRC522 properly connected?"));
|
||||
|
||||
@@ -132,7 +132,7 @@ void loop() {
|
||||
dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
|
||||
Serial.println();
|
||||
Serial.print(F("PICC type: "));
|
||||
byte piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
|
||||
MFRC522::PICC_Type piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
|
||||
Serial.println(mfrc522.PICC_GetTypeName(piccType));
|
||||
|
||||
// Try the known default keys
|
||||
|
||||
@@ -53,7 +53,7 @@ void loop() {
|
||||
Serial.print(mfrc522.uid.uidByte[i], HEX);
|
||||
}
|
||||
Serial.print(F(" PICC type: ")); // Dump PICC type
|
||||
byte piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
|
||||
MFRC522::PICC_Type piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
|
||||
Serial.println(mfrc522.PICC_GetTypeName(piccType));
|
||||
|
||||
byte buffer[34];
|
||||
|
||||
Reference in New Issue
Block a user