Jdy40 Arduino Example Best
Here’s a more useful example: a remote temperature sensor.
#include // RX on Pin 10, TX on Pin 11 SoftwareSerial jdySerial(10, 11); void setup() Serial.begin(9600); // For Serial Monitor jdySerial.begin(9600); // Default JDY-40 baud rate is 9600 Serial.println("JDY-40 Ready. Type data to send:"); void loop() // Receive from JDY-40 and show in Serial Monitor if (jdySerial.available()) Serial.write(jdySerial.read()); // Take input from Serial Monitor and send via JDY-40 if (Serial.available()) jdySerial.write(Serial.read()); Use code with caution. Copied to clipboard 3. Essential AT Configuration Commands
Arduino (Keeps the module permanently awake for this example). Step 1: Configuring Modules via AT Commands jdy40 arduino example best
A full-duplex communication bridge that allows the user to change the JDY-40 baud rate via Arduino code (removing the need for USB-to-TTL adapters for setup) and provides a "Heartbeat" signal quality indicator .
: Send AT+RFC001 -> Selects channel 1. Must match on both modules. Here’s a more useful example: a remote temperature sensor
void setup() Serial.begin(9600);
Think of it as a wireless serial cable. Whatever data you send from your Arduino's TX pin to the JDY-40's RX pin is transmitted "over the air" and will appear on the RX pin of the receiving module's connected Arduino. In its default transparent transmission mode , you don’t need to worry about packets, addresses, or acknowledgments; the module handles everything automatically. Copied to clipboard 3
| AT Command | Description | Default Value | Example | | :--- | :--- | :--- | :--- | | AT+BAUD | Set the serial baud rate. | 4 (9600) | AT+BAUD4 | | AT+RFC | Set the radio frequency channel (001-128). | 001 | AT+RFC010 | | AT+RFID | Set the wireless network ID (0000-FFFF). | 8899 | AT+RFID1234 | | AT+DVID | Set the device ID (0000-FFFF). | 1122 | AT+DVID0011 | | AT+POWE | Set the transmit power (0-9, higher = more power). | 9 | AT+POWE5 | | AT+CLSS | Set the operating mode ( A0 =Transparent, C1 =IO Send, C4 =IO Receive). | A0 | AT+CLSSC1 | | AT+VER | Query the firmware version. | N/A | AT+VER |
Below is a robust, production-ready master-slave code workflow. The Master reads an analog sensor value (like a potentiometer) and sends it wirelessly. The Slave receives it and adjusts the brightness of an LED. The Master Code (Transmitter)
. You can have one central "Hub" Arduino in your house and multiple "Remote" nodes (like an Arduino Uno