How to send data from RFID using RF module

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

void setup()
{
Serial.begin(9600); // Initiate a serial communication
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
Serial.println(“Approximate your card to the reader…”);
Serial.println();

}
void loop()
{
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor
Serial.print(“UID tag :”);
String content= “”;
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte < 0x10 ? " 0" : " ");
_ Serial.print(mfrc522.uid.uidByte*, HEX);_
_ content.concat(String(mfrc522.uid.uidByte < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte, HEX));
}
Serial.println();
Serial.print("Message : ");
content.toUpperCase();
if (content.substring(1) == “92 65 4A 2B”) //change here the UID of the card/cards that you want to give access*

* {
Serial.println(“Authorized access”);
Serial.println(“Welcome”);
Serial.println();
delay(30000);
}*_

else {
* Serial.println(" Access denied");*
* delay(3000);*
* }*
}
this is the coding that i used for RFID programming…
i want to send this UID number “92 65 4A 2B” using RF module…
really appreciate if u can help me…because i had google but found nothing about transfer data from RFID using RF module…

Please use code tags </> to present code.

Your code already creates an content string, which can be sent to any (serial) output device. See the examples for your RF module and library, how to send data to it.

You didn’t mention your RF device - how does it connect to the Arduino? If it uses a serial connection (Rx/Tx), it conflicts with the Serial (USB) connection; then you’ll need an Arduino with more Serial connections, or use a SoftwareSerial library.

Right, first things first.

Go and read the instructions, then go back and modify your post (use the "More --> Modify" option to the bottom right of the post) to mark up the code as such so we can examine it conveniently and accurately.

Since you did not do this, the code you post is already garbled and is certainly anything but easy to read.

Note: Also mark up any data in the same way. This includes error output that you get from the IDE.

And - before you post code, use "Auto Format" in the Tools menu to properly present the code.

DrDiettrich: You didn't mention your RF device - how does it connect to the Arduino?

Well, yes, he did actually, it is an MFRC522 which uses the SPI interface - just read the first two lines. :roll_eyes:

I believe it can alternatively use I2C if necessary.

sorry my bad…for the rf module im using 433MHz transmitter/receiver…since the data from rfid in “92 65 4A 2B”…should i declare to one number only…or can transmit all the number…

[code TRANSMITTER]
[/code
#include <VirtualWire.h>

char *controller;
void setup() {

vw_set_ptt_inverted(true); //
vw_set_tx_pin(8);
vw_setup(4000);// speed of data transfer Kbps
}

void loop()
{
controller=“2” ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(1000);

controller=“1” ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(1000);

controller=“0” ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(1000);

}]

[ code RECEIVER]
[/code
#include <VirtualWire.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
char cad[100];
int pos = 0;

void setup()
{
lcd.begin(16, 2);
vw_set_ptt_inverted(true); // Required for DR3100
vw_set_rx_pin(12);
vw_setup(4000); // Bits per sec

vw_rx_start(); // Start the receiver PLL running
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // Non-blocking
{
if(buf[0]==‘2’)
{
lcd.clear();
lcd.print(“Welcome”);
lcd.print(" TONY STARK");
}
if(buf[0]==‘1’)
{
lcd.clear();
lcd.print(“Welcome”);
lcd.print(" STEVE ROGERS");
}
if(buf[0]==‘0’)
{
lcd.clear();
lcd.print(“Welcome”);
lcd.print(" SAM WILSON");
}

}
}]

Please read this:- How to use this forum Because your post is breaking the rules about posting code.

Please insert the code between the “][” of the code tags, not before the last “]”.

You can fix this using the Edit button below your message. Remove the wrong code tags, then select your code and click on </>.

Doesn't go for instructions particularly well. :roll_eyes: