Hello everyone. Welcome back to the video. Number three point three.
And in this video. We're going to code development board
and send the commands
using the Bluetooth serial terminal mobile app. So guys,
let's get started with that. Okay.
before moving on
If you want to know more about the examples, you need to
click on the examples and in the Bluetooth, you have a lot of different examples.
And by the way, I choose serial to serial
BT and I modified the code according to my requirement. So
firstly we need to understand that how the process
will work. So we need to send either
one or either zero to the relay
to turn on or off the current so the lock
will be turned on or turn off according to the relay.
So we need a set of where our
mobile will connect it to the Bluetooth and mobile will send
the command 1 or either 0 to control
the lock. So that's why we need to include the Bluetooth
serial dot h and here we need to define the your
Bluetooth device name AI type esp32 Smart
Lock and these are some configurations.
It will just see if defined
or not different automatically Define this stuff.
So this is the important here. We need to define the
Bluetooth serial object and in the
setup
Actually, I'm using the pin 2.
For control the relay. So here's
the pin mod to output and by default
digital right to high to control the lock and serial
that begin and here the serial BT dot
begin. This is the object that we are
using begin and wise name. Is that variable
that we Define here. Esp32 Smart Lock
actually when you try to use it will
show you the name. Okay and is the
Serial printf the device with name is connected. And if
to find use pin we are not going to use the
pin so you can remove that line. Just
delete and
we are good to go with that. Okay, and here
is the loop serial rb2 data available. It will check
whether any data is available on
serial Bluetooth, then it comes inside and
here we will fetch the value serial. BT
dot read actually I'm using a corrector because we
only receive one RS 0 data. So if
the value is of one and digital right to come along
to
Open the lock and else if
value equal to 0 then digital right to high. So this
is the all the stuff and now I need to move
to the app area. The code has been already uploaded. So
you guys don't need to worry about that and for
the mobile app.
Here we have a Serial Bluetooth terminal.
Okay, just click on
that.
and air we need to
firstly you need to open up the Bluetooth. Okay from
that terminal. I already open that and
click on the device. And here we have a esp32
Smart Lock and it's trying to
connecting to asp32 Smart Lock and now
we need to send one.
Okay, and sorry, I need to plug the 12
volt adapter to see how it works.
And now you see it's working.
And if we would have the zero the lock will be
on okay, and if Y type
1 1 means open up and you see the lock
goes back and if I type
0 to make it close the lock will
be released. So now the next thing is
we need to create a custom app to control
our device stuff. So
in the next video, I'm going to create a app using MIT mobile
and winter by just drag
and drop and blocks and it will be
very
you can say that funny stuff. And
by the way, I will recommend to iot Geeks
that if you want to develop a mobile app,
then you need to use that stuff. It
makes you
super powerful
without any coding, so guys see you
in the next video. Have a good day. Bye.