Jdy40 Arduino Example Best
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);
For this system to work, all JDY-40 modules must share the same channel ( AT+RFC ) and network ID ( AT+RFID ).
Connect two separate Arduino boards (Transmitter and Receiver) using the following pinout: JDY-40 Pin Arduino Pin (Uno/Nano/Pro Mini) Do NOT connect to 5V GND Common ground TXD Pin 2 (Software RX) Receives data from JDY-40 RXD Pin 3 (Software TX) Use a 1kΩ resistor inline for 5V Arduinos SET Pin 4 (Digital Out) Controls AT Mode / Data Mode CS Kept permanently low for active state Configuring the JDY-40 via AT Commands jdy40 arduino example best
This comprehensive guide covers the ultimate JDY-40 Arduino implementation, complete with wiring diagrams, configuration steps, and robust master-slave communication code. Understanding the JDY-40 Module
void loop() float temp = dht.readTemperature(); float hum = dht.readHumidity(); void loop() // Relay any data from the
Use the same wiring as in Example 1. However, for the transmitter Arduino (the one with the sensor), you might want to use a different pair of pins for the JDY-40 so you can still use the built-in serial port for debugging. This is where SoftwareSerial becomes very useful.
void loop() // Read from Serial Monitor (PC) if (Serial.available()) String data = Serial.readString(); jdy40.print(data); // Send wirelessly to receiver However, for the transmitter Arduino (the one with
The module's default settings are usually sufficient for two units to communicate right out of the box. However, to change parameters like baud rate or channel, you'll need to use AT commands. You can do this directly from your Arduino.
Step 2: Best Arduino Code Example for Master-Slave Communication
: Sets the wireless network ID. Both modules must match. Example: AT+RFID12345678 .
: Send AT+RFID12345678 -> Must match on both modules.
















