Arduino Mysql Shield NFC Base de donnée

Fermé
beckeTho - 16 mai 2022 à 14:55
 BeckeTho - 24 mai 2022 à 16:29
Bonjour,
Je suis bloque sur mon projet de BTS est-ce-possible d'avoir de l'aide svp.
Une résidence privée souhaite mettre en œuvre la gestion d’un ensemble de parking accessible par accès sécurisé et vidéo-surveillé.
L’accès au parking est assuré par une barrière automatique. Les résidents peuvent accéder au parking sans contraintes horaires.

Ma partie consiste a gérer la production de badge; mettre en œuvre une base de données pour les référencement badge/résidents; enregistrer les logs et la configuration du système dans une base de données.


Configuration: Windows / Chrome 101.0.4951.54

1 réponse

jordane45 Messages postés 38197 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 30 mai 2024 4 675
16 mai 2022 à 20:38
Bonjour,

Commence par ça :
https://forums.commentcamarche.net/forum/affich-37586415-demander-de-l-aide-pour-vos-exercices-sur-ccm

Reviens ensuite nous voir en montrant ce que tu as fait et en expliquant en détails sur quel point technique précis tu bloques.
0
Voila le début de mon code sur Arduino, j'aimerais envoyer un msg en Hexa et si les personnes sont reconnus dans la bdd le portail s'ouvre en récupérant les référencements badge NFC et résident.


```
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>
#define PN532_SCK (2)
#define PN532_MOSI (3)
#define PN532_SS (4)
#define PN532_MISO (5)
#define PN532_IRQ (2)
#define PN532_RESET (3)
Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);


void setup(void) {
Serial.begin(9600);
while (!Serial) delay(10);

Serial.println("Hello!");

nfc.begin();

uint32_t versiondata = nfc.getFirmwareVersion();
if (! versiondata) {
Serial.print("Didn't find PN53x board");
while (1); // halt
}

Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);

nfc.SAMConfig();

Serial.println("Waiting for an ISO14443A Card ...");
}


void loop(void) {
uint8_t success;
uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };
uint8_t uidLength;


success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

if (success) {
// Affiche quelques informations de base sur la carte
Serial.println("Found an ISO14443A card");
Serial.print(" UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
Serial.print(" UID Value: ");
nfc.PrintHex(uid, uidLength);
Serial.println("");

if (uidLength == 4)
{

Serial.println("Seems to be a Mifare Classic card (4 byte UID)");



Serial.println("Trying to authenticate block 4 with default KEYA value");
uint8_t keya[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };


success = nfc.mifareclassic_AuthenticateBlock(uid, uidLength, 4, 0, keya);

if (success)
{
Serial.println("Sector 1 (Blocks 4..7) has been authenticated");
//uint8_t data[16];


// succès = nfc.mifareclassic_WriteDataBlock (4, données);


//success = nfc.mifareclassic_ReadDataBlock(4, data);

if (success)
{

//nfc.PrintHexChar(data,16);
Serial.print("Id reconnu");

Serial.print("BenoitLafont");





delay(1000);
}
else
{
Serial.println("Ooops ... unable to read the requested block. Try another key?");
}
}
else
{
Serial.println("Ooops ... authentication failed: Try another key?");
}
}

if (uidLength == 7)
{

Serial.println("Seems to be a Mifare Ultralight tag (7 byte UID)");


Serial.println("Reading page 4");
uint8_t data[32];
success = nfc.mifareultralight_ReadPage (4, data);
if (success)
{


nfc.PrintHexChar(data, 4);
Serial.println("");

// Attendez un peu avant de relire la carte
delay(1000);
}
else
{
Serial.println("Ooops ... unable to read the requested page!?");
}
}
}
}
```
0