MACPRofessionals | Bring Your Own Solution

Prizren

Team Updates

LOGO :D
LOGO :D
mrquantummechanicNart Gashi
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9
#define SS_PIN 10
MFRC522 mfrc522(SS_PIN, RST_PIN);
int door = 5;
void setup() {
Serial.begin(9600);
SPI.begin();
mfrc522.PCD_Init();
Serial.println(F("Read personal data on a MIFARE PICC:"));
pinMode(door, OUTPUT);
}
//*****************************************************************************************//
void loop() {
MFRC522::MIFARE_Key key;
for (byte i = 0; i < 6; i++) key.keyByte[i] = 0xFF;
byte block;
byte len;
MFRC522::StatusCode status;
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
Serial.println(F("**Card Detected:**"));
mfrc522.PICC_DumpDetailsToSerial(&(mfrc522.uid));
//mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
Serial.print(F("Name: "));
byte buffer1[18];
block = 4;
len = 18;
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 4, &key, &(mfrc522.uid)); //line 834 of MFRC522.cpp file
if (status != MFRC522::STATUS_OK) {
Serial.print(F("Authentication failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
status = mfrc522.MIFARE_Read(block, buffer1, &len);
if (status != MFRC522::STATUS_OK) {
Serial.print(F("Reading failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
//PRINT FIRST NAME
for (uint8_t i = 0; i < 16; i++)
{
if (buffer1[i] != 32)
{
Serial.write(buffer1[i]);
}
if (buffer1[i] > 3 ) {
digitalWrite(door, HIGH);
delay(600);
digitalWrite(door, LOW);
}
}
Serial.print(" ");
byte buffer2[18];
block = 1;
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 1, &key, &(mfrc522.uid)); //line 834
if (status != MFRC522::STATUS_OK) {
Serial.print(F("Authentication failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
status = mfrc522.MIFARE_Read(block, buffer2, &len);
if (status != MFRC522::STATUS_OK) {
Serial.print(F("Reading failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
//PRINT LAST NAME
for (uint8_t i = 0; i < 16; i++) {
Serial.write(buffer2[i] );
}
Serial.println(F("\n**End Reading**\n"));
delay(1000);
mfrc522.PICC_HaltA();
mfrc522.PCD_StopCrypto1();
}
void OpenDoor () {
digitalWrite(door, HIGH);
delay(1500);
digitalWrite(door, LOW);
}
//*****************************************************************************************//
#include <SPI.h>
#include <Ethernet.h>
int led = 4;
int pos = 0;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 0, 178 };
byte gateway[] = { 192, 168, 1, 1 };
byte subnet[] = { 255, 255, 255, 0 };
EthernetServer server(80);
String readString;
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
pinMode(led, OUTPUT);
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop() {
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
//read char by char HTTP request
if (readString.length() < 100) {
//store characters to string
readString += c;
//Serial.print(c);
}
//if HTTP request has ended
if (c == '\n') {
Serial.println(readString);
client.println("<html>");
client.println("<head>");
client.println("<title>Login - Doorino</title>");
client.println("</head>");
client.println("<body>");
client.println("<center>");
client.println("<form method=get>");
client.println("<input type=text value=Password name=ids />");
client.println("<input type=submit value=Log-In />");
client.println("</form>");
client.println("</center>");
client.println("</body>");
client.println("</html>");
delay(1);
client.stop();
if (readString.indexOf("?ids=113355") >0){
digitalWrite(led, HIGH);
delay(1500);
digitalWrite(led, LOW);
}
readString="";
}
}
}
}
}
<html>
<head>
<title>Login - Doorino</title>
</head>
<body>
<center>
<form>
<input type=text value=Password name=ids />
<input type=submit value=Log-In />"
</form>
</center>
</body>
</html>
mrquantummechanicNart Gashi
While Working :D
While Working :D
mrquantummechanicNart Gashi
When Finished The Project
When Finished The Project
mrquantummechanicNart Gashi
NASA Logo

SpaceApps is a NASA incubator innovation program.