MrStein KeyDuino TEAM
Messages : 85Reputation : 4Date d'inscription : 2015-10-10Age : 31Localisation : Lille, FRANCE Subject: NFC drawer lock Sat 10 Oct - 16:45 VIDEO
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); } } }
dinhgioimtp Newbie
Messages : 1Reputation : 0Date d'inscription : 2019-07-03 Subject: Re: NFC drawer lock Wed 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!
MrStein KeyDuino TEAM
Messages : 85Reputation : 4Date d'inscription : 2015-10-10Age : 31Localisation : Lille, FRANCE Subject: Re: NFC drawer lock Wed 3 Jul - 15:47
Sponsored content
Subject: Re: NFC drawer lock