in this video we are going to see how we can use this vl53l0x laser distance
meter to display the distance on this tm1637 display module
this is the wiring diagram for vl53l0x with tm1637 this portion of the wiring is the same
as before vcc is connected using a green wire to pin 13 which have been defined as an extra vcc in
the code ground is connected using a blue wire to ground off Arduino clock or scl have
been connected using a purple wire to the last pin this is also labeled as scl on the Arduino
and sda or data is connected using gray wire to the second pin which have been labeled
as sda for this tm1637 this is clock clock I’ve connected to pin five
and data and out the io have been connected using orange 2.6
and the vcc or VCC is connected using red wires to 5 volts and ground is
connected to the ground of Arduino if you are using this larger module
this data and clock is the same except these two pins you have to pay attention when the text is
at the top and the decimal points are low so pay attention to the vcc at the bottom it has
been labeled vcc and ground have been switched like this so these two wires have been switched
if you're using blue module the position of the wires are exactly the same nothing has changed
if you're using this module which is the largest purple
and if you're using this black module again the position of wires are the same just pay
attention to this red diode and stored with a vcc from the top and here is the wiring
from the left vcc is connected using this green wire to pin 13.
the ground is connected using blue to the ground of Arduino here and scl is connected using this
purple wire to the last pin this is scl on the Arduino and in the next pin
this is sda the data have been connected using this gray wire to the sda for the tm1637
ground has been connected using this brown wire to the ground of Arduino
vcc have been connected using this red wire to 5 volts
clock have been connected using this yellow wire 2.5 and data have been connected using orange 2.6
and if you're using this type of Arduino scl and sda has
not been labeled here but you'll see it here about the vcc of these two modules do not forget for the
larger module the ground and vcc have been swapped and vcc is on the other side while in this one vcc
is the second one the ground is the second here while in this module ground is on the last one
let me now explain the code this portion has not changed this is extra vcc for this
laser module we are defining pin 13. this is part of Arduino you don't need to download anything
this one as I’ve explained in previous lecture you need to download it for this led display
using tm1637 download and install this library pin five has been defined for clock and sex for
data input and output and then the test delay 500 I put it and that that's not important and
we create a from this class we create an instance and we pass pin five and six here
and this is for clear led clearing led every time the loop goes we have to clear the previous value
for four digits we send zero as I’ve explained it before inside the setup we initially the serial
monitor we set the vcc to pin 13 as an output using pin mode and using digital write pin 13 will
be high so we have five volts for the module for the laser module and this wire begin is for the
laser module this is initializing the module this is the timeout setup the rest is exactly the same
as before and here we are clearing that we are setting the brightness of the display
with zero f value and inside the loop we get the distance as before
in millimeter and store it in a variable called distance and in the display we first clear the
daily d with the value that we defined above and then show number decimal we print the decimal here
and the false means no zero on the left side four means four digit and zero means start
from far right first digit and this is to print the value on the serial monitor
and every 100 milliseconds we read the data
here's the demonstration of vl53l0x with tm1637 I’m putting it at 1660 millimeter and here it
shows 163. I’m also not precise here as well as there but this is pretty close and precise
this is around 102 millimeter and if I go now 38 millimeter and now let me point it to the wall
so that is one thousand one hundred about one thousand one hundred millimeters
I’m pointing it now down
you see that eight thousand one ninety is when it's out of range
let me remove this
use the other module
and as you can see it shows f now I have to now reset
this reset button press it and it will properly work
this was how to use this vl53l0x with tm1637 thank you for watching