dyulabs / KrishnaNaikTasks

Integration and testing of Radar Sensor
0 stars 0 forks source link

Integrate Radar Sensor and test for Occupancy #3

Open cdpdyulabs opened 5 months ago

Krishgt commented 5 months ago

include

HardwareSerial MMWave(1); const byte numChars = 32; char receivedChars[numChars];

BluetoothSerial SerialBT;

void setup() { Serial.begin(115200); MMWave.begin(115200, SERIAL_8N1, 16, 17); SerialBT.begin("ESP32-Bluetooth-Logger"); }

void loop() { static byte index = 0;

while (MMWave.available() > 0) {
    char rc = MMWave.read();

    if (rc == '\n') {

        receivedChars[index] = '\0';

        Serial.println(receivedChars);
        SerialBT.println(receivedChars);

        index = 0;
    } else if (rc != '\r') { 

        if (index < numChars - 1) {
            receivedChars[index++] = rc;
        }
    }
}

}