Un ├ęchange d'information autour de la carte KeyDuino
 
HomeHome  FAQFAQ  RegisterRegister  Log inLog in  

Share | 
 

 NFC logger

View previous topic View next topic Go down 
AuthorMessage
MrStein
KeyDuino TEAM
avatar

Messages : 60
Reputation : 3
Date d'inscription : 2015-10-10
Age : 24
Localisation : Lille, FRANCE

PostSubject: NFC logger   Sat 5 Dec - 12:23


Code:

/*
The goal of this sketch is to unlock your computer (for example) with KeyDuino and a NFC tag.
Get the ID of your tag, put it in NFC_KEY below, and set the PASSWORD of your computer.
When you scan the tag with KeyDuino, it will enter your password automatically, as if you had typed it with your keyboard.
More information in the video of the project: https://www.youtube.com/watch?v=TPVR7IkHJbM
Author: Mr Stein
Revised by Raymond Borenstein - CITC-EuraRFID
Compatible with KeyDuino 5.1
Join http://keyduino.forumsactifs.com/ to ask your questions, suggest your ideas, and show your projects!
*/

#include <KeyDuino.h>

KeyDuino keyDuino;

uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };
uint8_t uidLength;

String NFC_KEY_1 = "xxxx";
String NFC_KEY_2 = "xxxx";

String PASSWORD = "xxxxxxxx";

void setup(void) {
  Serial.begin(115200);
  keyDuino.begin();

  Serial.println("KeyDuino is ready, please scan a tag.");
}

void loop(void) {
  uint8_t success;
  String readID;
  success = keyDuino.readTargetID(uid, &uidLength);
  if (success){ 
    Serial.print("Tag found: ");
    readID = keyDuino.convertUintToString(uid, uidLength);

    if (readID == NFC_KEY_1 || readID == NFC_KEY_2){
      keyDuino.buzz(20);
      Keyboard.println(PASSWORD);
      delay(1000);
    }

  }
  else Serial.print(".");
}
Back to top Go down
http://keyduino.forumsactifs.com
 
NFC logger
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
KeyDuino forum :: KeyDuino projects & tutorial :: Tutorials :: Official tutorial-
Jump to: