Skip to content

Commit

Permalink
First
Browse files Browse the repository at this point in the history
  • Loading branch information
641i130 authored Nov 1, 2020
1 parent 9a5ebda commit 44de456
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions scan-in-cards.cpp
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);
}
*/

0 comments on commit 44de456

Please sign in to comment.