Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how do i get the individual information From each gate? #14

Open
WalrusHat opened this issue Aug 25, 2023 · 4 comments
Open

how do i get the individual information From each gate? #14

WalrusHat opened this issue Aug 25, 2023 · 4 comments

Comments

@WalrusHat
Copy link

No description provided.

@ncmreynolds
Copy link
Owner

As separately discussed, this would require adding support for engineering mode. Which I did look at briefly but never finished. Unfortunately I can't look at this for a few weeks.

@doc123307
Copy link

Good afternoon. I want to connect LD2410b to ARDUINO NANO using the UART protocol. I looked and tried everything, but nothing works.
Found an article on the Internet: https://wiki.dfrobot.com/SKU_SEN0557_24GHz_Human_Presence_Sensing_Module
But this code doesn't work either.
I will be very grateful for your help in the project.

I managed to output something with this code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // Определение программного последовательного порта: TX - 3, RX - 2

uint8_t Cache[23] = {0}; // Кэш для данных

void setup()
{
Serial.begin(115200);
mySerial.begin(57600); // Инициализация программного последовательного порта
}

void loop()
{
if (recdData(Cache)) {
// Данные успешно получены и обработаны
// Можно выполнять операции с полученными данными здесь
}
}

size_t readN(uint8_t *buf, size_t len)
{
size_t offset = 0, left = len;
int16_t Timeout = 1500; // Тайм-аут чтения
uint8_t *buffer = buf;
long curr = millis();
while (left) {
if (mySerial.available()) {
buffer[offset] = mySerial.read();
offset++;
left--;
}
if (millis() - curr > Timeout) {
break; // Выход по тайм-ауту
}
}
return offset;
}

bool recdData(uint8_t *buf)
{
int16_t Timeout = 50000; // Тайм-аут для получения данных
long curr = millis();
uint8_t ch;
bool ret = false;
while (!ret) {
if (millis() - curr > Timeout) {
break; // Выход по тайм-ауту
}
if (readN(&ch, 1) == 1) {
// Обработка данных
// В данном примере мы просто выводим данные на Serial
Serial.print("Received data: ");
Serial.println(ch);
ret = true; // Устанавливаем флаг, что данные получены успешно
}
}
return ret;
}

But it's not even close to centimeters:
https://drive.google.com/file/d/11epqswciyHE2KdFIjeal90KgwiE5nhZi/view?usp=sharing

@ncmreynolds
Copy link
Owner

The examples in this library should work with an LD2410, have you tried them?

@doc123307
Copy link

doc123307 commented Sep 20, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants