Hello i need a little help with a program please . I want to send a message for confirm with a module SIM800L after you present the tag at RFID MFRC522.
Here is the code....
If someone can help me please send the code on my email
MODERATOR EDIT : Email address removed to prevent spam
- Element listă
Thank you!
#include <deprecated.h>
#include <MFRC522.h>
#include <MFRC522Extended.h>
#include <require_cpp11.h>
#include <SPI.h>
#include <MFRC522.h>
#include <SoftwareSerial.h>
SoftwareSerial updateSerial();
SoftwareSerial mySerial(3, 2);
String textForSMS;
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
const int numOfCards = 4;//the nuber of cards used. this can change as you want
byte cards[numOfCards][4] = {{0x8D, 0x56, 0x54, 0x6E},{0xDB, 0x48, 0x8F, 0xB9},{0x53, 0xC5, 0xE3, 0x53} }; // array of UIDs of rfid cards
int n = 3;//n is for the total number of students//j is for to detect the card is valid or not
int numCard[numOfCards]; //this array content the details of cards that already detect or not .
String names[numOfCards] = {"A","B","C"};//student names
long telNumbers[numOfCards] = {+40755092992,+40770670461};//student sNumbers
void setup() {
// put your setup code here, to run once:
{
{
// put your setup code here, to run once:
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
//Serial.println("Scan a MIFARE Classic PICC to demonstrate Value Blocks.");
randomSeed(analogRead(0));
delay(1000);
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);{
//Begin serial communication with Arduino and mySerialL
mySerial.begin(9600);
Serial.println("Initializing...");
delay(1000);
mySerial.println("AT"); //Once the handshake test is successful, it will back to OK
updateSerial();
mySerial.println("AT+CSQ"); //Signal quality test, value range is 0-31 , 31 is the best
updateSerial();
mySerial.println("AT+CPIN=0000"); //Read SIM information to confirm whether the SIM is plugged
updateSerial();
mySerial.println("AT+CREG?"); //Check whether it has registered in the network
updateSerial();
}
}
}
}
void loop() {
// put your main code here, to run repeatedly:
void readRFID();
{
int j = -1;
byte card_ID[4];//card UID size 4byte
if ( ! mfrc522.PICC_IsNewCardPresent()) {//look for new card
return;//got to start of loop if there is no card present
}
if ( ! mfrc522.PICC_ReadCardSerial()) {// Select one of the cards
return;//if read card serial(0) returns 1, the uid struct contians the ID of the read card.
}
for (byte i = 0; i < mfrc522.uid.size; i++) {
card_ID[i] = mfrc522.uid.uidByte[i];
}
for (int i = 0; i < numOfCards; i++) {
if (card_ID[0] == cards[i][0] && card_ID[1] == cards[i][1] && card_ID[2] == cards[i][2] && card_ID[3] == cards[i][3]) {
j = i;
}
}
if(j == -1) {//check the card validity
invalid();
}
if (numCard[j] == 1) { //to check if the card already detect
alreadyRead(names[j], telNumbers[j], j);
}
else {
//send data to display and save
mySerial println("AT+CMGF=1\r")
delay(100)
mySerial println("AT + CMGS = \"telNumbers[j], j\"");
}
delay(1000);
}
}
> Text preformatat