In this lecture, I'll show you how to use the new pixels which are individually addressable AGP these
in this example, and using a module from other fruit that contains eight now pixels.
The nice thing about new pixels is that the micro python firmware contains a built-In driver.
So there's nothing else that you need to install and there's nothing else you need to Google around
and find.
So you simply import the nail pixel module and you're ready to go.
And here's the example here, which I also referenced in my example script.
In terms of the way that is connected, the pixel to the E.S.P 32, I'm just going to unplug it so we
can see in the back there are four pins, but really just three pins that you need to connect to the
ground, the data input pin and the five pin.
So obviously five votes spend goes to the final pin on the right to ground across the ground.
And for the end, you can choose whichever port you want.
In my case of connected to your 13, which is not even close to the five-fold pin, it makes it easier
to make short length connections.
All right.
Have a look at the example sketch.
Here are the connections that I'm using in this example.
Have got links to the appropriate documentation for the pixel driver and having a look at the header
of my program on importing the various modules, including random, since as you can see here, there's
a random pattern of colors that appears.
I create the PIN object here for the data input pin and then I'm passing that over to the pixel constructor
so that I can create the pixel object in my example.
As I said, I'm using our module from other Frood that contains eight new pixels on it.
Hence of code number eight here.
And the second parameter of the picture constructor.
Once you have the picks or object, you can treat it as an array and address each one of the nail pixels
individually.
So this example here, I'm going for the first pixel C zero, index zero, and I'm passing a color to
it.
And therefore, as I said, you can individually address each one of these no pixels.
I'm actually going to do this in a moment on this show down here.
Once you finish with setting the individual pixels, you call the right function and then the each picture
will display the configured color in the buffer.
I'm calling Buffer here, but of course, not doing anything because I haven't said anything.
So I'm just going to comment that out as well.
So in this example, we just go straight into this infinite loop.
I have a for loop that goes around and programs each one of the Nhill pixels individually.
Then for each Nael pixel x, which comes out of the loop structure, I just pick a color for each hajib,
red, green, blue.
I'm going from zero to 10 here in order to keep the intensity of the light that is coming out of the
pixels to low.
The maximum is 255, but it's almost impossible to look at the actual pixels in room lighting conditions
without going blind.
Now, pixels, very powerful light source.
So you'd be able to see them out in broad daylight as well.
But if you're planning to use your new pixels indoors, just tone it down a little bit by using our
smaller numbers for RGV.
All right.
So I'm programming each now pixel individually with a random color.
And once I go through the loop and all of the pictures are programmed, I call the right function and
that will pass the information off to the actual no pixels and create that color.
And I stay there for 60 milliseconds and I go through a similar loop and turn all of the pixels off
so that I can see the effect of the momentarily of situation for 15 milliseconds.
Just to make that blink kind of effect.
You can try it a few different other effects if you're interested in creating different patterns.
And this is the effect of this random color generator as it looks in the eight Nhill pixel module.
Just wanted to show you a little thing here on this.
You're going to hit control, see to cancel out of the program.
And I'm just going to.
Use the shell.
I could do a little bit of experimentation, so I've imported no pixels, I'm going to create a pin
object just copying from a program and then the pixel object as well.
And I'm going to go and turn on just enough pixel zero.
Actually, I'm going to turn them all off first, because as you can see from the previous example,
they are all running.
So let's do this with some kind of copy of this code for the loop so that if you type it in.
And then all of the pixels of.
Double enter and then call the write function.
OK.
The pictures are now of then less 10 pixel at index zero on.
So this is going to be AGP.
It's going to be blue at two hundred intensity.
Just bring back.
Right.
And there is.
The new picture with day or index zero as to the last one.
So this is going to be mostly red with a little bit of blue in it and call the right function again,
the kind of pink, I think.
OK, so that's basically how you go about individually creating colors or assigning colors to each pixel.
It can also get the color of a individual pixel by using this notation to just read or extract the colors
for it to be from no pixel position zero.
And that will give you.
So they are a zero, the G zero.
Let's check out the blue said there would be just as multiple assignment in a single line of code so
I can extract the current colors of the particular nail pixel.
All right.
It's about it.
So that's how you can use the new pixels with your DP 32 and.