Fight in this lecture, we'll show you how to drive the next seven to one night metrics display like
this one here in this demonstration, in which case I have connected four of those individual displays
in a row.
You can see that by just tuning the display over these displays have an input and an output.
So this is where one can connect to the other and then create various configurations.
I've chosen to go for a single row of these displays using for displays one after the other.
But you can also configure it as a rectangle or as a square.
So I'm going to like this one back in.
Right.
I'm going to have to initialize it, not to get the last one to work.
One thing that I do with all of my displays is that I use a sticker to indicate the drive circuit for
the display because typically it's not indicated on the participation of printed on.
And it's an important piece of information to know so that, you know, which driver, which software
driver to use.
All right.
So I begin by having a look at the wiring information and then we'll look at the software side and talk
about the driver that I've found and used and found that it works with this display.
And you that a couple of examples.
In the first example, she had to just display random pixels.
And then in the next example, in the next lecture, she had to display text.
But I'm also going to talk about how to create about graphics primitives like lines and circles.
It's actually very easy with a driver that I found.
All right.
So about the wiring first hand this thing over.
You can have a look at the wiring in conjunction with the software.
Because of the header of my example script.
I've indicated the wiring as well.
So you've got the ground pin which goes to any of the ground pins on the HP to in my case, I have connected
the ground pins, the green jumper wire.
It goes to the ground power rail on the breadboard.
Then we've got this you see this display, it requires five votes, so this is C is the blue wire that
goes here, and then I'm using this long red jumper wire to connect it to the east, whether it is five
or 10 right there.
Next up, we've got the data in PIN now I forgot to mention that this display is using the spy interface.
So data in for the spy interface is the Mausi.
PIN, which is PIN 23 on the E.S.P 32, this pin right here.
I'm using a jumper wire to take that out and connect it to display.
Now we've got the spy clock pin, which is.
Pain 18, it is this one right here.
And finally, we need the SS pin, which is the chip select or spy traditional Parli, it is the sleeve
select for this right here, which you can use any pin, actually.
And I've used your five for this.
So these are the pin outs.
Having done that, let's check out the software side, so for the software side, I have chosen and
found that it works this library here.
It's called Max 71 nine Thorpey.
Why there's information on where to get it from and also have the information.
Or I should have that information in which I just put it in right now that would give here.
It paste doesn't quite work.
All right.
This is for the max seven two one nine driver library.
All right.
So as you can see, this is not a big library.
Builds on the frame buffer module, which is built into the micro python firmware.
And so it builds onto that and makes it possible to do things such as fill the whole screen with a particular
color, either on or off the black or white.
I guess you would call that you can create individual pixels.
So this is the function that we are using in this demonstration.
You can create horizontal and vertical lines, arbitrary lines from any point to any other point, rectangles
and field rectangles.
Text, which will be using in the next example, can get text to scroll.
I'm not sure what it is.
And then you can initialize the screen, which is also something that we are using.
These are the available functions that this driver library provides us to back into the demonstration
sketch.
In this example, I just wanted to show random pixels so there wasn't much to it.
I have imported the appropriate modules, the library itself and then the pen and spy functions from
the machine module you time so I can put a little bit of sleep.
You can see that happening here 15 milliseconds.
And then I also imported the random module so that I can add a bit of randomness when I am calculating
or actually figuring out which early days or which pixels to turn on.
Other than that, I am creating the spy object here.
This is spy object with the two because the civil nuclear documentation can see that the E.S.P 32 with
this micro python implementation has got to S.P.I hardware interfaces available.
The first one has got ID one and these are the pince.
So this interface 14, 13 and 12 for Clock Mozi and Mizu.
And the second one, which is the one that I'm using, have got these two bios for the three pins of
the interface and I'm using 23 and I'm not using the MISO GPA because I don't need it with this interface.
So one way only.
So I'm using this constructor to create the spy object I'm defining here Jhpiego number five to be my
slave selector or chip select.
And then I'm using this constructor, the eight by eight constructor and much six, eight by eight to
create an object that allows me to control this row of four matrix displays.
So I'm passing the SBI object, the slate select or CHIP select Tapio.
And then I'm indicating that this is going to be a display with four eight by eight displays in a row.
And that's the display object.
Next, I'm using the full function to turn all of the entities off.
So in effect, I'm painting it black, setting the brightness to five and that's how bright Brightness
five is.
I want to know more of that brightness than what the limits are.
You can just go to the library itself and just search for full brightness or the right part of the word
is enough.
And you can see that the limits are from zero to 15 with Tuffin being the brightest possible setting.
And after that, we are ready to start printing pixels, so we've got a loop that repeats 10 times because
what I want to do is to create 10 randomly little pixels across my screen.
And I do that by calculating a random X and Y position.
So if you look at the pixel function in the driver library right here.
Here it is, you'll see that it requires an X, a Y and optionally a color, which I am passing a color
X Y so that the pixel is turned on.
So here's my color one.
And then for the exposition.
The exposition is this.
So this is pixel number one, so this is pixel number zero index and zero in the x axis and this is
31.
So I'm getting a random number between zero and thirty one.
And I'm doing the same thing for the Y axis vertical.
So this is zero on the Y axis and this is eight on the Y axis.
And then that would give me a random number between zero and eight.
I don't remember if the eight is inclusive.
So if the top end of this range is inclusive.
Having a look at the random module in here, we've got.
The random E.A. function, which is a function that I'm using and you can see that this is returning
a random number between A and B, inclusive of A and B.
So there's the answer to this function is going to return a random number between zero and eight once
I've got my ten random pixels in the buffer of my display and I call the show function to make the numbers
visible, leave them visible for 15 milliseconds, then empty the display display off by writing zero
and then go back and calculate and create the next ten random pixels.
If I comment out this dysfunction.
Can heat control see now to stop execution and then save and upload again?
You see that you get this effect where eventually the display turns all on the wall itself being on.
All right, what about effect as well as quite nice?
All right, so that's how you can use this eight by eight display to randomly display pixels and then
let's have a look in.
The next picture will show you how to display text.