Forum >Replies by Ludvigaldrin
userhead Ludvigaldrin
Replies (2)
  • You Reply:

    This is how I got it working in the end. The main issue was that my used mySerial.begin to the same port as the print out for Serial. That mean I did not get any data output. 

    I also could not use the 

    int val = sensor.readPresenceDetection();

    that blocks the code completely. 

     

    I have used pins for me to just solder pins on all sensor ports and direct on to the ESP32 mini. So VCC/GND is deciding which legs are used for readPin and RX/TX

     

    So for all you that are looking for a working example with DFRobot SEN0395 here it is:

     

    #include <DFRobot_mmWave_Radar.h>

    HardwareSerial mySerial(1);DFRobot_mmWave_Radar sensor(&mySerial);int readPin = 16; // where pinout GPIO2

    void setup() {

     pinMode(readPin, INPUT);

     mySerial.begin(92600, SERIAL_8N1, 21, 22);// RX AND TX  pinMode(LED_BUILTIN, OUTPUT);  sensor.factoryReset();    //Restore to the factory settings  sensor.DetRangeCfg(0, 1);    //The detection range is as far as 9m sensor.OutputLatency(0, 0);  Serial.begin(115200);}

    void loop() { int val = digitalRead(readPin); digitalWrite(LED_BUILTIN, val); Serial.println("Detection result: "); Serial.println(val);    delay(1000);

    }

     

    Hope it works out good for the rest of you

  • You Reply:

    Thanks. This got me on the right track. Se my code in the next comment