#include SoftwareSerial jdy40(2, 3); // RX, TX void setup() Serial.begin(9600); jdy40.begin(9600); // Default AT baud rate Serial.println("Enter AT Commands:"); void loop() if (jdy40.available()) Serial.write(jdy40.read()); if (Serial.available()) jdy40.write(Serial.read()); Use code with caution. Useful AT Commands AT (Returns OK ) Check Version: AT+VERSION Set Channel: AT+CL001 (Sets channel to 1, range 001-128) Set Address: AT+ADDR1234 (Sets address to 1234) Reset: AT+RESET 5. Troubleshooting Common JDY-40 Issues No Communication: Ensure the CS pin is grounded.
Upload the same simple code to both Arduinos. It simply echoes any data it receives from the other module.
Here is a quick reference of the most common AT commands to get you started:
#include // Define pins for JDY-40 serial communication const int jdyRx = 2; const int jdyTx = 3; SoftwareSerial jdySerial(jdyRx, jdyTx); const int sensorPin = A0; void setup() Serial.begin(9600); jdySerial.begin(9600); Serial.println("Transmitter Ready."); void loop() int sensorValue = analogRead(sensorPin); // Package data with a simple prefix and suffix for reliability jdySerial.print("<"); jdySerial.print(sensorValue); jdySerial.print(">"); // Debug output to local Serial Monitor Serial.print("Sent: "); Serial.println(sensorValue); delay(500); Use code with caution. 2. Receiver Code
Match the baud rates on both modules and ensure SoftwareSerial matches jdy40.begin() .
This sketch reads an analog input (like a potentiometer) and transmits the data every 500 milliseconds.
/* * Title: JDY-40 Smart Bridge & Link Monitor * Description: The "Best" example to configure JDY-40 and monitor connection health. * * Circuit: * - JDY-40 TX -> Arduino Pin 2 * - JDY-40 RX -> Arduino Pin 3 * - Built-in LED (Pin 13) used for Link Status. */
: The JDY-40 logic is 3.3V. If using a 5V Arduino Uno or Nano, place a voltage divider or a 1k resistor between the Arduino TX pin and the JDY-40 RXD pin.
are highly recommended for beginners. These resources demonstrate how to use the Go to product viewer dialog for this item.
If you run into issues, here are the most common problems and solutions:







