Jdy40 Arduino Example Best
Same as above, but you'll open the Serial Monitor.
Have you used the JDY-40? What project are you building? Let me know in the comments!
// Prepare JDY-40 (connected to hardware serial pins 0/1) pinMode(2, OUTPUT); // SET pin digitalWrite(2, LOW); // Enter AT mode (for configuring) // We'll set the channel and ID inside the loop, before each transmission.
This transmitter code reads a sensor value (simulated via an analog pin) and packs it into a structured, delimited string format. Sending data with start and end markers prevents packet fragmentation issues over the air. jdy40 arduino example best
You can use the same code on both Arduinos if you configure the modules with the same settings (same CLSS and DAAI).
: The JDY-40 pulls current spikes during transmission. Solder a 10uF to 100uF capacitor directly across the VCC and GND pins of the module to prevent resets.
, though many breakout boards include a regulator allowing for 5V input. For the best stability on an Arduino Uno, follow this wiring scheme: Longan Labs JDY-40 Pin Arduino Pin 3.3V or 5V Check your breakout board's requirements. Common ground is essential for signal integrity. Digital Pin 3 Connect to Arduino's TX pin (via SoftwareSerial). Digital Pin 2 Connect to Arduino's RX pin (via SoftwareSerial). GND / D-Pin Ground this pin to enter "Serial Communication Mode". Ground this pin to wake the module from sleep. Same as above, but you'll open the Serial Monitor
You can configure these features using AT commands when the SET pin is grounded: : Change serial speed (Default is 9600 ).
| Mode | Description | | :--- | :--- | | A0 | Use for general data transfer. | | C0/C1 | Remote Control Transmitter. Sends key press status from GPIO pins. | | C2 | Remote Control Receiver. GPIO goes high for 30ms when a signal is received. | | C3 | Remote Control Receiver. GPIO goes low for 30ms when a signal is received. | | C4 | Remote Control Receiver. GPIO acts as a latch, toggling state with each signal. | | C5 | Remote Control Receiver. Inverts the GPIO level upon receiving a signal. |
/* * JDY-40 AT Command Configurator * This sketch sets the module to channel 5, ID 1, and queries the version. * Connect SET to pin 2, CS to pin 3, and the serial lines to RX/TX. */ Let me know in the comments
Как работать с беспроводным модулем jdy-40 и ардуино?
Before writing code, it is essential to understand the hardware. The JDY-40 operates within a 2.2V to 3.6V range and features a transmission range of up to 120 meters in open space. Module Pin Configuration Description Power Supply 2.2V - 3.6V (Do not connect directly to 5V Arduino VCC) GND Connect to Arduino GND TXD Serial Transmit Connect to Arduino RX (Use logic level shifter if 5V) RXD Serial Receive Connect to Arduino TX (Use logic level shifter if 5V) SET Mode Configuration
The is a highly efficient 2.4GHz wireless transceiver module favored for its simplicity, as it operates as a standard UART serial bridge . Unlike the more complex NRF24L01, it does not require specialized libraries for basic communication, making it an excellent choice for beginner Arduino projects like remote sensor reporting or wireless robots. Quick Review & Specifications
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