This example demonstrates the best practice for robust wireless communication. It sends a structured payload (sensor data) from a Transmitter node and receives it safely on a Receiver node using start/end markers to prevent data corruption. Transmitter Code (Sensor Node)
(both sides identical):
Before using the modules to send data, ensure they are configured identically. This sketch puts the connected JDY-40 into AT command mode, sets its parameters, and then returns it to transparent mode. jdy40 arduino example best
#include <SoftwareSerial.h>