Jdy40 Arduino Example Best High Quality Jun 2026
// All done; you can now use the module for wireless serial communication.
This public link is valid for 7 days and shares a thread, including any personal information you added. This link or copies made by others cannot be deleted. If you share with third parties, their policies apply. Can’t copy the link right now. Try again later.
The module has basic pins that interface easily with any Arduino board:
are highly recommended for beginners. These resources demonstrate how to use the Go to product viewer dialog for this item.
void loop() if (Serial.available() > 0) // If data is typed in Serial Monitor String data = Serial.readString(); // Read the data Serial1.print(data); // Send it wirelessly jdy40 arduino example best
Based on these results, I can write a comprehensive article covering:
The JDY-40's native "transparent transmission" is a broadcast: every module on the same frequency and network ID receives every message. In a multi-node setup, you need a way for the hub to talk to individual nodes without them all responding at once.
void loop() if (Serial1.available() > 0) // If data is received wirelessly String receivedData = Serial1.readString(); // Read the data Serial.print("Received: "); Serial.println(receivedData); // Print it to Serial Monitor
This guide covers everything you need to know about the JDY-40. You will learn how it works, how to configure it with AT commands, and how to build a working transmitter and receiver system. Understanding the JDY-40 Module // All done; you can now use the
#include SoftwareSerial jdyWireless(2, 3); // RX, TX const int setPin = 4; const int ledPin = 6; // PWM capable pin // Variables for parsing incoming packet safely const byte numChars = 32; char receivedChars[numChars]; boolean newData = false; void setup() pinMode(setPin, OUTPUT); digitalWrite(setPin, HIGH); // Set to transparent data mode pinMode(ledPin, OUTPUT); Serial.begin(9600); jdyWireless.begin(9600); Serial.println("Slave Receiver Ready."); void loop() recvWithStartEndMarkers(); processNewData(); // Best practice function for non-blocking serial parsing void recvWithStartEndMarkers() static boolean recvInProgress = false; static byte ndx = 0; char startMarker = '<'; char endMarker = '>'; char rc; while (jdyWireless.available() > 0 && newData == false) rc = jdyWireless.read(); if (recvInProgress == true) if (rc != endMarker) receivedChars[ndx] = rc; ndx++; if (ndx >= numChars) ndx = numChars - 1; else receivedChars[ndx] = '\0'; // terminate the string recvInProgress = false; ndx = 0; newData = true; else if (rc == startMarker) recvInProgress = true; void processNewData() if (newData == true) int controlValue = atoi(receivedChars); // Convert text to integer Serial.print("Received Value: "); Serial.println(controlValue); // Constrain and adjust LED brightness controlValue = constrain(controlValue, 0, 255); analogWrite(ledPin, controlValue); newData = false; Use code with caution. Best Practices for Peak JDY-40 Performance
void setup() Serial.begin(9600); // Must match the JDY-40 baud rate (default 9600)
This setup uses pins 2 (RX) and 3 (TX) on the Uno via the SoftwareSerial library, preserving the default hardware serial for debugging.
To safely connect a 5V Arduino to a 3.3V JDY-40, you use a voltage divider on the Arduino's TX line going to the JDY-40's RX. A simple solution is a resistor divider: a 2.2kΩ resistor between the 5V TX pin and the JDY-40's RX pin, and a 3.3kΩ resistor from the JDY-40's RX pin to GND. Alternatively, use a dedicated logic level converter. If you share with third parties, their policies apply
Add a 100µF capacitor across VCC and GND on the JDY-40. This filters noise from the Arduino’s regulator and doubles the effective range.
: The JDY-40 pulls spikes of current during transmission. If the connection drops unexpectedly, place a 10µF to 100µF capacitor across the VCC and GND pins of the JDY-40 to smooth out power delivery.
: Send AT+BAUD4 -> Sets baud rate to 9600 (Default).