Jdy40 Arduino Example Best -
Upload the same simple code to both Arduinos. It simply echoes any data it receives from the other module.
// JDY-40 connected to pins 2 (RX) and 3 (TX) SoftwareSerial jdy40(2, 3); jdy40 arduino example best
void setup() Serial.begin(9600); // Serial Monitor for debugging pinMode(3, OUTPUT); // Pin to control the JDY-40 SET pin Upload the same simple code to both Arduinos
AT+RFID (Default is 1024 ). Both modules must match. Both modules must match
Here is where 90% of problems happen. Still, to be safe and reliable:
void loop() // Relay any data from the Serial Monitor to the JDY-40 if (Serial.available() > 0) String comdata = ""; while (Serial.available() > 0) comdata += char(Serial.read()); delay(2);
#include SoftwareSerial jdyWireless(2, 3); // RX, TX void setup() Serial.begin(9600); jdyWireless.begin(9600); Serial.println("System initialized. Ready to send/receive data..."); void loop() // Check if data is received from the remote JDY-40 module if (jdyWireless.available()) Serial.print("Received: "); while (jdyWireless.available()) char inChar = (char)jdyWireless.read(); Serial.write(inChar); Serial.println(); // Check if there is data from local serial monitor to transmit if (Serial.available()) String outData = Serial.readStringUntil('\n'); jdyWireless.println(outData); Serial.print("Sent: "); Serial.println(outData); Use code with caution. Advanced Best Practices for Production Projects



