Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of RFID-RC522 by
Revision 3:7d6438351a2a, committed 2017-12-09
- Comitter:
- nantalukp12
- Date:
- Sat Dec 09 12:41:07 2017 +0000
- Parent:
- 2:a0c7513fb634
- Commit message:
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Jun 06 03:04:48 2014 +0000
+++ b/main.cpp Sat Dec 09 12:41:07 2017 +0000
@@ -1,32 +1,14 @@
-//Test of cheap 13.56 Mhz RFID-RC522 module from eBay
-//This code is based on Martin Olejar's MFRC522 library. Minimal changes
-//Adapted for Nucleo STM32 F401RE. Should work on other Nucleos too
-
-//Connect as follows:
-//RFID pins -> Nucleo header CN5 (Arduino-compatible header)
-//----------------------------------------
-//RFID IRQ=pin5 -> Not used. Leave open
-//RFID MISO=pin4 -> Nucleo SPI_MISO=PA_6=D12
-//RFID MOSI=pin3 -> Nucleo SPI_MOSI=PA_7=D11
-//RFID SCK=pin2 -> Nucleo SPI_SCK =PA_5=D13
-//RFID SDA=pin1 -> Nucleo SPI_CS =PB_6=D10
-//RFID RST=pin7 -> Nucleo =PA_9=D8
-//3.3V and Gnd to the respective pins
-
#include "mbed.h"
#include "MFRC522.h"
-
-// Nucleo Pin for MFRC522 reset (pick another D pin if you need D8)
#define MF_RESET D8
DigitalOut LedGreen(LED1);
-
-//Serial connection to PC for output
Serial pc(SERIAL_TX, SERIAL_RX);
MFRC522 RfChip (SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, MF_RESET);
int main(void) {
+ int data[10];
pc.printf("starting...\n");
// Init. RC522 Chip
@@ -36,6 +18,14 @@
LedGreen = 1;
// Look for new cards
+ if(data[0] == 199 && data[1] == 230 &&data[2] == 46 &&data[3] == 0 )
+ {
+ pc.printf(" admin \n");
+ data[0] = 0;
+ data[1] = 0;
+ data[2] = 0;
+ data[3] = 0;
+ }
if ( ! RfChip.PICC_IsNewCardPresent())
{
wait_ms(500);
@@ -55,13 +45,17 @@
pc.printf("Card UID: ");
for (uint8_t i = 0; i < RfChip.uid.size; i++)
{
- pc.printf(" %X02", RfChip.uid.uidByte[i]);
- }
+ data[i] = RfChip.uid.uidByte[i];
+ pc.printf("%d ", data[i]);
+
+ }
+
+ //pc.printf("\n\r");
+ //pc.printf("\n\r");
+ //char data[0];
+ //pc.printf(" %X02", data[0]);
+ //pc.printf(" %s\n", data[0]);
+
pc.printf("\n\r");
-
- // Print Card type
- uint8_t piccType = RfChip.PICC_GetType(RfChip.uid.sak);
- pc.printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType));
- wait_ms(1000);
}
-}
\ No newline at end of file
+}
--- a/mbed.bld Fri Jun 06 03:04:48 2014 +0000 +++ b/mbed.bld Sat Dec 09 12:41:07 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600 \ No newline at end of file
