Seeeduino LoraWan with Grove-TF Mini LiDAR

Hi,

I have an Grove-TF Mini LiDAR, that I can’t get working using my Seeeduino LoraWan. I connected the Tx and Rx wires to pin 0 and 1 and used the code of Seeed ( http://wiki.seeedstudio.com/Grove-TF_Mini_LiDAR/ ). But the Seeeduino isn’t printing anything on the screen. :frowning:
[code]

void setup()
{
Serial1.begin(115200);
SerialUSB.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;
        SerialUSB.print(t2);
        SerialUSB.print('\t');

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

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

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

}

Hello,

I’m not very sure, but are you sure this line code to definate as unsigned int instead of unsigned char correct?
[code] unsigned int t1 = Serial1.read(); //Byte3
unsigned int t2 = Serial1.read(); //Byte4

I[/code]
Could you please post how you connect the wire?

Hello,



I implemented your code, it works well when I have replaced
</s>unsigned int t1 = Serial1.read(); //Byte3 unsigned int t2 = Serial1.read(); //Byte4<e>

with
</s>unsigned char t1 = Serial1.read(); //Byte3 unsigned char t2 = Serial1.read(); //Byte4<e>




and when definite those variable as [b]unsigned int[/b], the data sent by serial port is following, which is wrong:


[img]
https://github.com/SeeedDocument/forum_doc/blob/50522548e2da4e5923900fff752e15ea37a5194d/image/U5%7BPPDHWUXL17KVYNRB%5D33O.png?raw=true
[/img]