899212d7b9
Define AUTH_UID and AUTH_UID_SIZE constants. Introduce motor control pins IN_1‑IN_4 and set them as outputs. Comment out turn‑signal and sonar pin definitions and related code. Refactor Display to remove updateDirection functionality. Extend RFIDReader with reset() and matches() methods; use them to toggle carEnabled based on RFID authentication. Update the main loop to operate only when the RFID tag matches the authorized UID.
26 lines
376 B
C++
26 lines
376 B
C++
#pragma once
|
|
#include <SPI.h>
|
|
#include <MFRC522.h>
|
|
|
|
class RFIDReader {
|
|
public:
|
|
RFIDReader(int ssPin, int rstPin);
|
|
|
|
void begin();
|
|
|
|
bool check();
|
|
|
|
void reset();
|
|
|
|
void printUID() const;
|
|
|
|
bool matches(const byte* expectedUid, byte expectedSize) const;
|
|
|
|
const byte* getUID() const;
|
|
byte getUIDSize() const;
|
|
|
|
private:
|
|
MFRC522 _rfid;
|
|
MFRC522::MIFARE_Key _key;
|
|
};
|