Hello everyone,
topic is still alive .... talking with HLink representative.
Here are some important points :
- The device has a pair of pins named SCL / SDA but the device is not i2c compatible.
- We need a « UART TTL output device » to talk with the device
- FT232RL seems to not be a proper tool for that.
I have now a copy of the software shown in the user manual (pdf). It works well under Windows, but needs the appropriate UART TTL to communicate with the HLK-LD8001b through USB
Any idea about UART communication is welcome.
I've tried unsuccessfully the SoftwareSerial.h library like this:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
byte message1[] = {0x01, 0x80, 0x00, 0x00, 0x04, 0x01, 0x00, 0x7B, 0x00, 0x00, 0x20, 0x40, 0x9F };
byte message2[] = {0x01, 0x80, 0x01, 0x00, 0x04, 0x01, 0x01, 0x7B, 0x40, 0x1F, 0x00, 0x00, 0xA0};
byte message3[] = {0x01, 0x80, 0x02, 0x00, 0x04, 0x01, 0x02, 0x7B, 0x3C, 0x00, 0x00, 0x00, 0xC3};
byte message4[] = {0x01, 0x80, 0x03, 0x00, 0x04, 0x01, 0x03, 0x7B, 0x33, 0x33, 0x73, 0x40, 0xCC};
int rendu = 0;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for Native USB only
}
Serial.println("Début");
// set the data rate for the SoftwareSerial port
mySerial.begin(115200);
mySerial.write(message1, sizeof(message1));
mySerial.write(message2, sizeof(message2));
mySerial.write(message3, sizeof(message3));
mySerial.write(message4, sizeof(message4));
}
void loop() {
Serial.print ("Passage: ");
Serial.println(++rendu);
mySerial.write(message1, sizeof(message1));
mySerial.write(message2, sizeof(message2));
mySerial.write(message3, sizeof(message3));
mySerial.write(message4, sizeof(message4));
if (mySerial.available()) { Serial.println(mySerial.read()); }
if (Serial.available()) { mySerial.write(Serial.read()); }
delay(1500);
}