Created
October 25, 2023 23:48
-
-
Save johnwargo/159f8808b4b14694b953a7e96b48cb6f to your computer and use it in GitHub Desktop.
Sample application for testing the DFRobot mmWave Radar - 24GHz Human Presence Detection Sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
@file DFRobot_mmWave_Radar.ino | |
@ Read whether there is people or object moving in the detection range of the sensor. | |
@ The sensor detection range and output delay time can be configured. Also you can restore the sensor to factory default settings. | |
@n Experimental phenomenon: When the sensor starts successfully, 0 or 1 will be printed on the serial monitor. | |
@ 0 means that there is no human or object moving in sensing area, 1 means the oppposite. | |
@copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) | |
@licence The MIT License (MIT) | |
@version V1.0 | |
@date 2023-3-13 | |
@https://github.com/DFRobot | |
*/ | |
#include <DFRobot_mmWave_Radar.h> | |
HardwareSerial mySerial(1); | |
DFRobot_mmWave_Radar sensor(&mySerial); | |
// int LED_BLINK = 10; | |
void setup() { | |
Serial.begin(115200); | |
mySerial.begin(115200, SERIAL_8N1, 20, 22); //RX,TX | |
pinMode(LED_BUILTIN, OUTPUT); | |
sensor.factoryReset(); //Restore to the factory settings | |
sensor.DetRangeCfg(0, 3); //The detection range is as far as 3m | |
sensor.OutputLatency(2, 2); | |
} | |
void loop() { | |
int val = sensor.readPresenceDetection(); | |
digitalWrite(LED_BUILTIN, val); | |
Serial.println(val); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment