Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:03 12 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Code example for VL53L0X?

Author Message
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 12:16pm 01 Dec 2018
Copy link to clipboard 
Print this post

Hi to Everybody

Does anyone have experience or simple code to show me to work with this device?
VL53L0X Time-of-Flight ranging and gesture detection sensor

Thanks
AntonioEdited by sagt3k 2018-12-02
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4133
Posted: 12:54pm 01 Dec 2018
Copy link to clipboard 
Print this post

Using a web search I see code on the net - what's wrong with that?

John
 
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 02:02pm 01 Dec 2018
Copy link to clipboard 
Print this post

Hi JohnS

I have problem with registers maps.
Do you have clear documentation ?
Thanks
Antonio
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4133
Posted: 03:53pm 01 Dec 2018
Copy link to clipboard 
Print this post

I'm lost here as to what you want - read the data sheet?

It's I2C and it states the address.

John
 
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 09:08pm 01 Dec 2018
Copy link to clipboard 
Print this post

Hi JohnS

My problem is to find documentation on register map

Here is the code, really basic, but I can not find documentation on the registers map to understand if I can improve the noise I have in reading.

Dim from As integer = 30
Dim maxregs As integer = from+2
Dim buff(maxregs) As integer
Dim R As Float
SetPin 38,dout : Pin(38)=1

Do
ReadI2C
Pause 50
Loop

Sub ReadI2C
I2C OPEN 400, 1000
I2C WRITE &H29, 0, 2, 0, 1
I2C READ &H29, 0, maxregs,buff()
If MM.I2C Then Print "Slave did not respond"
I2C CLOSE
x = (buff(from)<<8)+buff(from+1)
If X>20 Then Print Timer,Str$(x/10,3,1)"cm"
End Sub


This is the result,with the sensor still and placed in front of a fixed and smooth object:

597845 69.8cm
598001 68.1cm
598055 67.8cm
598211 68.9cm
598265 67.9cm
598319 67.6cm
598373 67.2cm
598529 67.5cm
598583 68.3cm
598637 67.8cm
598691 67.1cm
598745 69.5cm
598799 68.0cm
598853 66.9cm
598907 67.6cm
599063 67.8cm
599117 69.1cm
599171 67.8cm
599225 68.3cm
599279 68.6cm
599333 70.2cm
599387 67.3cm
599543 66.7cm
599597 68.7cm
599651 68.0cm
>

Thanks
Antonio
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025