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

Share | 
 

 NFC logger

Go down 
AuthorMessage
MrStein
KeyDuino TEAM
avatar

Messages : 81
Reputation : 3
Date d'inscription : 2015-10-10
Age : 25
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
kthorpe88
Newbie
Newbie


Messages : 4
Reputation : 0
Date d'inscription : 2017-11-26

PostSubject: Re: NFC logger   Sun 26 Nov - 1:40

I was able to make this work by following the video. Although I went back into serial monitor after making sure it works to read the id of another tag. When I scanned a new tag it just says tag found and does not list the id of the tag like it first did. What am I doing wrong?
Back to top Go down
MrStein
KeyDuino TEAM
avatar

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

PostSubject: Re: NFC logger   Sun 26 Nov - 7:50

Hum in fact it miss this :
Serial.print(readID);

Just after this
readID = keyDuino.convertUintToString(uid, uidLength);

Keep me in touch if it doesn't work Wink
Back to top Go down
http://keyduino.forumsactifs.com
kthorpe88
Newbie
Newbie


Messages : 4
Reputation : 0
Date d'inscription : 2017-11-26

PostSubject: Re: NFC logger   Mon 27 Nov - 4:55

That did the trick, I was thinking it needed something like that but didn't know the terms. This is all new to me and learning as I go. Thanks a lot!
Back to top Go down
kthorpe88
Newbie
Newbie


Messages : 4
Reputation : 0
Date d'inscription : 2017-11-26

PostSubject: Re: NFC logger   Mon 27 Nov - 5:02

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

   if (readID == NFC_KEY_1 || readID == NFC_KEY_2){
     keyDuino.buzz(20);
     Keyboard.write(0xDA);
     delay(200);
     Keyboard.println(PASSWORD);
     delay(200);
     Keyboard.write(0xB0);
     delay(200);




That's the end of the code that I use to unlock a windows 7 & 10 machine.
Back to top Go down
Sponsored content




PostSubject: Re: NFC logger   

Back to top Go down
 
NFC logger
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: