corrected translation of hex numbers to decimal numbers (#342)
This commit is contained in:
@@ -2,17 +2,17 @@
|
|||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
* This is a MFRC522 library example; see https://github.com/miguelbalboa/rfid
|
* This is a MFRC522 library example; see https://github.com/miguelbalboa/rfid
|
||||||
* for further details and other examples.
|
* for further details and other examples.
|
||||||
*
|
*
|
||||||
* NOTE: The library file MFRC522.h has a lot of useful info. Please read it.
|
* NOTE: The library file MFRC522.h has a lot of useful info. Please read it.
|
||||||
*
|
*
|
||||||
* Released into the public domain.
|
* Released into the public domain.
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
* This sample shows how to read and write data blocks on a MIFARE Classic PICC
|
* This sample shows how to read and write data blocks on a MIFARE Classic PICC
|
||||||
* (= card/tag).
|
* (= card/tag).
|
||||||
*
|
*
|
||||||
* BEWARE: Data will be written to the PICC, in sector #1 (blocks #4 to #7).
|
* BEWARE: Data will be written to the PICC, in sector #1 (blocks #4 to #7).
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Typical pin layout used:
|
* Typical pin layout used:
|
||||||
* -----------------------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------------------
|
||||||
* MFRC522 Arduino Arduino Arduino Arduino Arduino
|
* MFRC522 Arduino Arduino Arduino Arduino Arduino
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
* SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16
|
* SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16
|
||||||
* SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14
|
* SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14
|
||||||
* SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15
|
* SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
@@ -56,7 +56,7 @@ void setup() {
|
|||||||
Serial.print(F("Using key (for A and B):"));
|
Serial.print(F("Using key (for A and B):"));
|
||||||
dump_byte_array(key.keyByte, MFRC522::MF_KEY_SIZE);
|
dump_byte_array(key.keyByte, MFRC522::MF_KEY_SIZE);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
Serial.println(F("BEWARE: Data will be written to the PICC, in sector #1"));
|
Serial.println(F("BEWARE: Data will be written to the PICC, in sector #1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,8 +95,8 @@ void loop() {
|
|||||||
byte dataBlock[] = {
|
byte dataBlock[] = {
|
||||||
0x01, 0x02, 0x03, 0x04, // 1, 2, 3, 4,
|
0x01, 0x02, 0x03, 0x04, // 1, 2, 3, 4,
|
||||||
0x05, 0x06, 0x07, 0x08, // 5, 6, 7, 8,
|
0x05, 0x06, 0x07, 0x08, // 5, 6, 7, 8,
|
||||||
0x08, 0x09, 0xff, 0x0b, // 9, 10, 255, 12,
|
0x09, 0x0a, 0xff, 0x0b, // 9, 10, 255, 11,
|
||||||
0x0c, 0x0d, 0x0e, 0x0f // 13, 14, 15, 16
|
0x0c, 0x0d, 0x0e, 0x0f // 12, 13, 14, 15
|
||||||
};
|
};
|
||||||
byte trailerBlock = 7;
|
byte trailerBlock = 7;
|
||||||
MFRC522::StatusCode status;
|
MFRC522::StatusCode status;
|
||||||
@@ -159,7 +159,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
Serial.print(F("Data in block ")); Serial.print(blockAddr); Serial.println(F(":"));
|
Serial.print(F("Data in block ")); Serial.print(blockAddr); Serial.println(F(":"));
|
||||||
dump_byte_array(buffer, 16); Serial.println();
|
dump_byte_array(buffer, 16); Serial.println();
|
||||||
|
|
||||||
// Check that data in block is what we have written
|
// Check that data in block is what we have written
|
||||||
// by counting the number of bytes that are equal
|
// by counting the number of bytes that are equal
|
||||||
Serial.println(F("Checking result..."));
|
Serial.println(F("Checking result..."));
|
||||||
@@ -177,7 +177,7 @@ void loop() {
|
|||||||
Serial.println(F(" perhaps the write didn't work properly..."));
|
Serial.println(F(" perhaps the write didn't work properly..."));
|
||||||
}
|
}
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
// Dump the sector data
|
// Dump the sector data
|
||||||
Serial.println(F("Current data in sector:"));
|
Serial.println(F("Current data in sector:"));
|
||||||
mfrc522.PICC_DumpMifareClassicSectorToSerial(&(mfrc522.uid), &key, sector);
|
mfrc522.PICC_DumpMifareClassicSectorToSerial(&(mfrc522.uid), &key, sector);
|
||||||
|
|||||||
Reference in New Issue
Block a user