I am using ( or atleast trying ) to send RFID data via a RF link using the following libraries :
For RFID : GitHub - miguelbalboa/rfid: Arduino RFID Library for MFRC522
For RF24 : https://github.com/TMRh20/RF24/archive/master.zip
#include <SPI.h>
#include <RF24.h>
//#include <MFRC522.h>
/****************** User Config ***************************/
/* Hardware configuration: Set up nRF24L01 radio on SPI bus plus pins 7,8 */
RF24 radio(7, 8);
/**********************************************************/
byte myAddress[6] = "RxBBB"; // Radio pipe addresses of this receiver - must match with one in Tx code Slave1.
boolean recvData[2];
byte ackPayLoad[8] = {1,2,3,4,5,6,7,8};
#define RfidRst 9 // RFID reset pin
#define RfidSel 10 // RFID select pin
// INSTANTIATE THE RFID READER MFRC522
//MFRC522 mfrc522(RfidSel, RfidRst);
void setup()
{
Serial.begin(9600);
Serial.println(F("*** STARTING RECIEVER *** "));
// INITIALIZE THE MFRC522 READER
//mfrc522.PCD_Init();
// Setup and configure radio
radio.begin();
radio.setChannel(108); // Above most Wifi Channels
radio.setDataRate( RF24_250KBPS );
radio.setPALevel(RF24_PA_MAX);
radio.enableDynamicPayloads(); // Ack payloads are dynamic payloads
radio.openReadingPipe(1, myAddress);
radio.enableAckPayload();
radio.writeAckPayload(1, &ackPayLoad, sizeof(ackPayLoad)); // pre-load data for first acknowledgement
radio.startListening();
}
//****************************************************
void loop(void)
{
byte pipeNo = 1;
if ( radio.available(&pipeNo)) // Is payload available from Tx ?
{
radio.read( &recvData, sizeof(recvData)); // Get the Payload from Tx & check what user wants to do
//getRFID();
radio.writeAckPayload(pipeNo, &ackPayLoad, sizeof(ackPayLoad )); // Send Ack Payload to Tx with the RFID data
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/*
// FUNCTION TO READ RFID TAG AND CONVERT IT TO A 4 BYTE DATA
int getRFID() {
if ( ! mfrc522.PICC_IsNewCardPresent()) { //New PICC ? ... continue
return 0;
}
if ( ! mfrc522.PICC_ReadCardSerial()) { //Get Serial and continue.
return 0;
}
for (int i = 0; i < mfrc522.uid.size; i++) {
ackPayLoad[i] = mfrc522.uid.uidByte[i];
}
mfrc522.PICC_HaltA(); //Stop reading
return 1;
}
*/
I am able to get an active Radio Link with the transmitter, only when I disable all references to the MFRC522 library ( as in the copied code above ). I am not sure where the conflict is. I have taken care to avoid clashes in the SS pins for both the RF24 and RFID module.
Any possible points to check ?? Thanks in advance ...