When building networks with more than two devices, change the device type configuration command to or AT+CLSSA2 . This shifts the module out of transparent broadcast mode into an addressed mode, where packets are prefixed with a specific Device ID ( D_ID ). The module will automatically discard any packets that do not explicitly match its own hardcoded D_ID , reducing overhead processing on your host Arduino microcontrollers.
While the HC‑05 remains one of the most popular Bluetooth modules for Arduino, the JDY‑40 offers several distinct advantages:
Serial.println("Waiting for Bluetooth data..."); jdy40 arduino example best
#include const int rxPin = 2; const int txPin = 3; const int setPin = 4; SoftwareSerial jdy40(rxPin, txPin); void setup() pinMode(setPin, OUTPUT); // Enter AT command mode by pulling SET pin LOW digitalWrite(setPin, LOW); delay(100); Serial.begin(9600); jdy40.begin(9600); Serial.println("JDY-40 AT Command Mode Ready."); Serial.println("Type AT commands in the Serial Monitor."); void loop() // Pass data from Arduino Serial Monitor to JDY-40 if (Serial.available()) jdy40.write(Serial.read()); // Pass data from JDY-40 back to Arduino Serial Monitor if (jdy40.available()) Serial.write(jdy40.read()); Use code with caution. Essential AT Commands
This sketch reads a button on pin 7 and sends the string "Button Pressed" to the other module. When building networks with more than two devices,
: 3.3V to 3.6V (Do not connect to Arduino 5V without a regulator) GND : Ground (Must be shared with Arduino Ground) TXD : Transmit Pin (Connects to Arduino RX)
If the SET pin is left floating or loose on a breadboard, the module can unexpectedly bounce into AT config mode, causing regular serial data transfers to drop out completely. Tie it firmly to VCC via a pullup or control it actively via a digital pin driven HIGH . While the HC‑05 remains one of the most
: Receive Data pin (connects to Arduino's TX via a voltage divider).
The JDY-40 supports AT commands. To change the baud rate or channel, connect the SET pin to 3.3V before powering up the module. Then you can send commands like AT+BAUD4 (for 115200) or AT+RFCH1 (for channel 1).