[I want a node] TFMini Lidar Distance Sensor

TF mini

Require XOD Node for Arduino MKR1010
Serial/Uart communication

Outputs

(number/distance)

Extra info:
Byte1-0x59, frame header, all frames are the same
Byte2-0x59, frame header, all frames are the same
Byte3 Dist_L distance value is a low 8-bit.
Byte4 Dist_H distance value is a high 8-bit.
Byte5 Strength_L is a low 8-bit.
Byte6 Strength_H is a high 8-bit.
Byte7 Integration time.
Byte8 Reserved bytes.
Byte9 Checksum parity.

Hi, publish a very simple library based on TF Mini LiDAR from DFRobot cesars/tfmini-lidar

no libries are required. i got the lidar working off the Arduino IDE with this simple code (see below) found on the WikiSeedStudio.
serial software lib. or other sample programs for the tfmini did not work did not work… with MKR1010.

Regards,

Hal

unsigned char dta[100];
unsigned char len = 0;

void setup()
{
Serial1.begin(115200);
Serial.begin(115200);
}

void loop()
{
while(Serial1.available()>=9)
{
if((0x59 == Serial1.read()) && (0x59 == Serial1.read())) //Byte1 & Byte2
{
unsigned int t1 = Serial1.read(); //Byte3
unsigned int t2 = Serial1.read(); //Byte4

        t2 <<= 8;
        t2 += t1;
        Serial.print(t2);
        Serial.print('\t');

        t1 = Serial1.read(); //Byte5
        t2 = Serial1.read(); //Byte6

        t2 <<= 8;
        t2 += t1;
        Serial.println(t2);

        for(int i=0; i<3; i++) 
        { 
            Serial1.read(); ////Byte7,8,9
        }
    }
}

}

Did you try using the xod/uart library to parallel this code? There is a example-read.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.