So right now, we have everything up and ready, let us start writing some code, they're going to go
to text.
It's like, OK, and here we go.
No, the first thing we want to do is at the library that will interface this LCD, go simply to libraries
here and just choose liquid crystal.
Now, we have added with the.
The second thing we want to do is let's delete all of this on the sirloins.
Here, we need to initialize the pins.
No, here's what I'm going to do, if you type liquid crystal or Adreno and go inside the website,
you're going to see the library right here.
And you're going to see all the functions that can be used.
OK, so let's click on Liquid Crystal.
The first function, well, this function is used in order to initialize your LCD.
So we are going to use the forward mode.
We're going to use this formula first, then we're going to input is the address.
Second is the E for the enable.
Then we have the four bits of data.
Right.
That's a this is all we need.
Now, there are other modes where we can specify if we are going to eat.
We can use this for if we are using eight bits form, we can use this form of we are raising greed.
Right.
And a bit we can use this one.
But for us, this is what we need.
OK, so I'm going to go here and I'm going to simply type liquid.
Crystal, exactly like this, and I'm going to define that this is my LCD.
OK, let us see the pins first.
It says yes, then enable what is the PIN number of my address?
This is my earth and it's going to 12th.
Next, I have my made might enable my enable is going to 11, as we can see here.
So next is 11.
Then you have the 45.
These six and seven.
OK, the four is five.
Then we have four, three, two.
So we have five, four, three, two.
This is how we tell our object right here, the LCD.
What's going on exactly.
And what is the wiring we are using now?
If you change the pins, all you need to do is change the order of the pins right here or the number
of the pins according to the reference right here.
Now, any function you see in order, we know you can just Google it, go to Adreno and just find their
reference, are on how you can pass parameters to it.
OK, that's wonderful.
Next.
Now there is something called LCD Biggin.
Remember the serial you'll begin to use?
Well, there's something called LCD begin.
Now, if we go to LCD begin here, we can see what it takes.
It says specify how many columns and how many rows we have.
As I said, there are multiple LCD.
Some of them are sixteen by four.
Some of them are sixteen by sixteen.
There is tons of LCD, so you need to specify columns and rows.
In our case, we would say LCD.
Dots begin and then how many columns we have, we have 16 and we have two rows.
This is the size of my LCD.
This is the first step we want to do.
OK, now let's say I start simulation.
As you can see, nothing happens yet.
Now, what's the next thing going to do?
Well, how about we print some stuff?
It's very easy to print things if you go to the manual again.
And you just got to print.
You would see that print, you can print whatever you want inside it, and you should be able to see
it.
OK, so let's say here I go, LCD, dot print.
This is my first priority.
Now, this could be larger, so it could be cropped.
Let us start simulation.
And as you can see, this is my first this is my first is being printed.
Well, but we can see that the back light is not actually functioning properly, but a stop simulation.
All right, while we don't have backlight, let us check this, OK?
The thing is, we needed 220 ohms, but not kilotons.
OK, now let us start simulation again.
And as you can see, there is my backlight.
OK, so this resistor right here also affects your backlight if it's connected correctly.
Now, I want to try something.
If I remove this video.
And start simulation, as you can see, I have a back light in the lead, but the video is not actually
turning on now simply if I return it, I can see my lady.
So the video is responsible to light those.
And this is responsible.
Say, if I remove it, there is no back light.
So this LSD, my back light, this video is actually my brightness.
All right.
That's a great let's go back to the code and let us do more interesting stuff.
Let's say that I want to write things in the first line and other things in the second line.
I could say LCD that set.
And I want to set it to zero zero, so let's try to print something right now, LCD.
The Brent hi.
Let's see, what will this do if I click on Simulation?
As you can see, I am setting my cursor here at the beginning and I am printing high as simple as that.
Now take a look here.
If let's say I said this to 5:00 and start simulation.
It's going to jump zero, one, two, three, four, five, and it's going to start writing from here.
So this gursel here is going to specify where should I start my writing?
OK.
That's great, let's say I want to write something else.
Let's now Elsie the Dodd said kurzer.
And this time I want to set it to zero.
One.
OK, I'm going to right here, LCD dot print there.
OK, now that a start simulation.
And as you can see, setting this one will jump to the next line right here, so zero means here zero
and one means here's one.
So this is like a matrix by 16 by two matrix.
And you can see the cogs, the cursor, wherever you want.
OK.
Now, how about I want to print valuables, what if I wanna print valuables, so let's say I print tie
and then I wanna print something else.
Let's say here I want to use a Falu, I wanna print the counter for integer I equals zero.
Let's say I want to count between zero and five hundred.
I is less or equal to five hundred I plus plus.
Let's use the curly balances and here I'm going to be printing I and I want to delay a little bit in
between if we print, let's say, for 50 milliseconds.
All right.
Now let's start simulation.
And as you can see, I am printing them like this all next to each other.
Now, this is not a very good idea because when you set a cursor, it's it's going to move the horizontal
one at every right.
And that's something we don't really want in this case.
I want to set always the cursor where I want and then I want to print.
So with every iteration of setting it at the same place and I am printing my result now, if I start,
you will see that I am counting and it will keep counting till 500 and it will go back again.
As I said, said Cursor is after it's done execution, it's going to push the cursor by one horizontally.
And this is why we got that long string over there.
But if we want to wait in the same place with every iteration, you just want to set the cursor one
more time that required to place and it will reset at 500.
And as you can see, it's resetting.
All right, let's agree, this is a very basic example on how we can use our LCD.
Now, you can go back here and you can just explore all of this.
You could also experiment with custom characters.
You can maybe create a smiley face.
You can create whatever you want and you can read this reference in order to do it.
I really encourage you to explore this library and get good use of it, because it has a lot of useful
stuff like auto scroll.
It has great characters.
There is a blank for the text.
It has a lot of cool stuff that you can try.
I hope you have enjoyed this and the next lecture.