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