Sometimes you need to change the channel, address, or baud rate. Use a connected to the module.
This code receives the data and prints it to the Serial Monitor.
. It is highly valued for its simplicity, as it uses a standard UART interface that can be controlled with basic serial commands on an Arduino MSS Eletrônica 1. Hardware Setup & Pinout operates on iFuture Technology . Connecting it to a 5V source may damage the module : 2.2V to 3.6V MSS Eletrônica : System ground. : Connect to the Arduino's RX/TX pins (cross-connected) iFuture Technology
// Define RX and TX pins for the JDY-40 // JDY-40 TX connects to Arduino Pin 2 // JDY-40 RX connects to Arduino Pin 3 SoftwareSerial jdySerial(2, 3); // RX, TX
The JDY-40 is a Bluetooth 4.0 module based on the CSR8510 chipset. It supports a wide range of Bluetooth protocols, including SPP (Serial Port Protocol), HID (Human Interface Device), and more. The module operates at a frequency of 2.4 GHz and has a maximum data transfer rate of 1 Mbps.
AT+POWE (Values range from 0 to 9; 9 is maximum power). Reset Module: AT+RESET clears buffers and applies changes. The Best JDY-40 Arduino Code Example
#include SoftwareSerial jdySerial(2, 3); // RX, TX const int sensorPin = A0; unsigned long previousMillis = 0; const long interval = 100; // Send data every 100ms void setup() jdySerial.begin(9600); Serial.begin(9600); pinMode(sensorPin, INPUT); void loop() unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) previousMillis = currentMillis; int sensorValue = analogRead(sensorPin); // Package data with start '<' and end '>' markers for reliability jdySerial.print('<'); jdySerial.print(sensorValue); jdySerial.print('>'); Serial.print("Sent Sensor Value: "); Serial.println(sensorValue); Use code with caution. Slave Code (The Receiver)
#include <SoftwareSerial.h>
(available in source repository).
This sketch reads a button on pin 7 and sends the string "Button Pressed" to the other module.
Note: Both modules must have the exact same RFID string to talk to each other. AT+DVID5566 Note: Both modules must share the same DVID. Reset Module: AT+RESET Part 2: Best Two-Way Transparent Communication Example