KeyDuino forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.


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

 

 NFC drawer lock

Go down 
2 posters
AuthorMessage
MrStein
KeyDuino TEAM
MrStein


Messages : 85
Reputation : 4
Date d'inscription : 2015-10-10
Age : 30
Localisation : Lille, FRANCE

NFC drawer lock Empty
PostSubject: NFC drawer lock   NFC drawer lock EmptySat 10 Oct - 16:45


Code:

/*********************************
 Code by Pierre CHARLIER (mrstein@hotmail.fr)
 Please remplace the "xxxxxxxxxx" by your tag ID.
 You will need KeyDuino library to use it.
 ***********************************/


#include "KeyDuino.h"
KeyDuino keyDuino;

 #define GACHE 12
 #define LED 13

//definition des clefs
String CLEF1 = "xxxxxxxxxx";
String CLEF2 = "xxxxxxxxxx";
String CLEF3 = "xxxxxxxxxx";



//*******************Tag READ fonction
String fct_lecture() {
  String Received;
  boolean success;
  uint8_t IdReceived[] = { 0, 0, 0, 0, 0, 0, 0 };
  uint8_t Id_Length;

  if (success = keyDuino.readPassiveTargetID(PN532_MIFARE_ISO14443A, &IdReceived[0], &Id_Length)) {
    for (uint8_t i = 0; i < Id_Length; i++)
      Received += String(IdReceived[i], HEX);
    Serial.println(Received);
    return (Received);
  }
  else
    return ("NULL");
}




void setup(void) {
  Serial.begin(115200);
  keyDuino.begin();
  pinMode(GACHE, OUTPUT);
  pinMode(LED, OUTPUT);
  digitalWrite(LED, HIGH);
  Serial.println("NFC LOCK");
}



void loop(void) {
  String Received;
  Received = fct_lecture();
  if ((Received == CLEF1 || Received == CLEF2  || Received == CLEF3)) {
    Serial.println("STATE: OPEN");
    digitalWrite(GACHE, HIGH);
    delay(2000);
    Serial.println("STATE: CLOSE");
    digitalWrite(GACHE, LOW);
  }

  else {
    if (Received != 0) {
      Serial.println("Key not found");
keyDuino.buzz(20);
    }
  }
}

Back to top Go down
https://keyduino.forumsactifs.com
dinhgioimtp
Newbie
Newbie



Messages : 1
Reputation : 0
Date d'inscription : 2019-07-03

NFC drawer lock Empty
PostSubject: Re: NFC drawer lock   NFC drawer lock EmptyWed 3 Jul - 14:30

bonjour! Puis-je utiliser le verrou NFC pour ma moto? Si oui, comment le code va-t-il changer? merci Je vous souhaite une bonne journée!
Back to top Go down
MrStein
KeyDuino TEAM
MrStein


Messages : 85
Reputation : 4
Date d'inscription : 2015-10-10
Age : 30
Localisation : Lille, FRANCE

NFC drawer lock Empty
PostSubject: Re: NFC drawer lock   NFC drawer lock EmptyWed 3 Jul - 15:47

Salut!
Ton objectif est de déverrouiller ta moto ou bien de la faire démarrer? dans les deux cas c'est un peu complexe comme il faut bidouille le système d'anti démarrage mais tu peux retrouver des pistes pour ton système avec les tuto suivants :
https://keyduino.forumsactifs.com/t24-nfc-doors-unlock
https://www.youtube.com/watch?v=7se3nwdTd9o&t=5s
Back to top Go down
https://keyduino.forumsactifs.com
Sponsored content





NFC drawer lock Empty
PostSubject: Re: NFC drawer lock   NFC drawer lock Empty

Back to top Go down
 
NFC drawer lock
Back to top 
Page 1 of 1
 Similar topics
-
» NFC lock GIFT box
» Entry door electronic lock

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