-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
// USED FOR SCANNING IN NEW CARD AND COPYING/PASTING THEM INTO MAIN.CPP | ||
#include <SPI.h> | ||
#include <MFRC522.h> | ||
#include <SoftwareSerial.h> | ||
#include <ESP8266WiFi.h> | ||
#include <WiFiClient.h> | ||
#include <ESP8266WebServer.h> | ||
#include "index.h" //html page | ||
// Variables for card reader: | ||
#define SS_PIN 15 | ||
#define RST_PIN 0 | ||
int del = 3000; | ||
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. | ||
int x = 1; | ||
char *arr[] = {}; | ||
int arrlen = 100; | ||
int t; | ||
String cardid; | ||
void setup() { | ||
Serial.begin(9600); // Initiate a serial communication | ||
SPI.begin(); // Initiate SPI bus | ||
mfrc522.PCD_Init(); // Initiate MFRC522 | ||
Serial.println("Ready to read cards!"); | ||
Serial.println(""); | ||
} | ||
void loop() { | ||
// Look for new cards | ||
if ( ! mfrc522.PICC_IsNewCardPresent()) { | ||
return; | ||
} | ||
// Select one of the cards | ||
if ( ! mfrc522.PICC_ReadCardSerial()) { | ||
return; | ||
} | ||
//Show UID on serial monitor | ||
Serial.print('"'); | ||
String content= ""; | ||
for (byte i = 0; i < mfrc522.uid.size; i++) { | ||
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); | ||
Serial.print(mfrc522.uid.uidByte[i], HEX); | ||
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ")); | ||
content.concat(String(mfrc522.uid.uidByte[i], HEX)); | ||
}; | ||
Serial.print("[Spacer]"); | ||
delay(500); | ||
} | ||
*/ |