24#define RADAR_RX_PIN 16
25#define RADAR_TX_PIN 17
28#define RADAR_BAUDRATE 256000
50 Serial.println(
"Radar reboot initiated.");
53 Serial.println(
"Failed to init reboot.");
72 Serial.println(
"Config applied successfully. Rebooting radar...");
76 Serial.println(
"Error! Could not send reboot command to the sensor");
83 Serial.println(
"Failed to apply config.");
103 Serial.println(
"Failed to request config data.");
107 Serial.println(
"Config data received. Cloning and modifying...");
120 Serial.println(
"Error! Could not update config on the sensor");
139 Serial.begin(115200);
143 Serial.println(
"LD2410Async example: change resolution and reboot");
150 Serial.println(
"Radar task started successfully.");
156 Serial.println(
"Error! Could not start config data request");
160 Serial.println(
"Error! Could not start radar task.");
void onReboot(LD2410Async *sender, LD2410Async::AsyncCommandResult result)
Callback after the reboot command has been confirmed.
HardwareSerial RadarSerial(1)
void onConfigReceived(LD2410Async *sender, LD2410Async::AsyncCommandResult result)
Callback after requesting config data.
void setup()
Arduino setup function which initializes the radar and starts the config change process.
void onConfigApplied(LD2410Async *sender, LD2410Async::AsyncCommandResult result)
Callback after applying modified config.
LD2410Async radar(RadarSerial)
Creates LD2410Async object bound to the serial port defined in RadarSerial.
#define RADAR_RX_PIN
Example: Changing detection resolution on LD2410.
void loop()
Arduino loop function which does nothing.
Asynchronous driver class for the LD2410 human presence radar sensor.
bool rebootAsync(AsyncCommandCallback callback)
Reboots the sensor.
bool begin()
Starts the background task that continuously reads data from the sensor.
AsyncCommandResult
Result of an asynchronous command execution.
@ SUCCESS
Command completed successfully and ACK was received.
bool configureAllConfigSettingsAsync(const LD2410Types::ConfigData &configToWrite, bool writeAllConfigData, AsyncCommandCallback callback)
Applies a full ConfigData struct to the LD2410.
LD2410Types::ConfigData getConfigData() const
Returns a clone of the current configuration data of the radar.
bool requestAllConfigSettingsAsync(AsyncCommandCallback callback)
Requests all configuration settings from the sensor.
@ RESOLUTION_20CM
Each gate is about 0.20 m, max range about 1.8 m.
DistanceResolution distanceResolution
Current distance resolution. A reboot is required to activate changes after configureAllConfigSetting...