Page 1 of 1

Infrared Laser Distance Sensor (50m/80m)

Unread postPosted:Mon May 03, 2021 11:09 am
by marcus.hardie
I carnt communicate with the Infrared Laser Distance Sensor (50m/80m) sensor.
Ive wired it up exactly as shown in the tutorial and copyied the code.
I get the error
sketch_may03b.ino:12:34: warning: narrowing conversion of '128' from 'int' to 'char' inside { } [-Wnarrowing]
char buff[4]={0x80,0x06,0x03,0x77};
^
Please help

Re: Infrared Laser Distance Sensor (50m/80m)

Unread postPosted:Fri May 07, 2021 9:56 am
by 347945801
Your array is defined with char, but the content is of type uint8_t, so you need to change one of them. The definition and content type should be consistent.
If your intention is to convert ascii codes into characters, it is best to use characters directly.