/* mifare ultralight example (25-02-2018) * * RFID-RC522 (SPI connexion) * * CARD RC522 Arduino (UNO) * SDA1 ----------- 10 (Configurable, see SS_PIN constant) * SDA2 ----------- 0 (Configurable, see SS_PIN constant) * SCK ----------- 13 * MOSI ----------- 11 * MISO ----------- 12 * IRQ ----------- * GND ----------- GND * RST ----------- 9 (onfigurable, see RST_PIN constant) * 3.3V ----------- 3.3V * */ #include #include #define SS_1_PIN 10 #define SS_2_PIN 8 #define RST_PIN 9 #include #ifdef __AVR__ #include #endif #define PIN 6 #define NUM_LEDS 141 #define BRIGHTNESS 5 Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800); constexpr uint8_t NR_OF_READERS = 1; byte ssPins[] = {SS_1_PIN, SS_2_PIN}; MFRC522 mfrc522[NR_OF_READERS]; MFRC522::StatusCode status; //variable to get card status byte buffer[18]; //data transfer buffer (16+2 bytes data+CRC) byte size = sizeof(buffer); uint8_t pageAddr = 0x06; //In this example we will write/read 16 bytes (page 6,7,8 and 9). //Ultraligth mem = 16 pages. 4 bytes per page. //Pages 0 to 4 are for special functions. void setup() { Serial.begin(9600); // Initialize serial communications with the PC SPI.begin(); // Init SPI bus for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) { mfrc522[reader].PCD_Init(ssPins[reader], RST_PIN); // Init each MFRC522 card Serial.print(F("Reader ")); Serial.print(reader); Serial.print(F(": ")); mfrc522[reader].PCD_DumpVersionToSerial(); strip.setBrightness(BRIGHTNESS); strip.begin(); strip.show(); // Initialize all pixels to 'off' } Serial.println(F("Sketch has been started!")); } uint32_t curColor=strip.Color(255,0,0); String mystring; int offset = 3; void loop() { for(int r = 0;r