Let's look at a third party library and third party library I'm going to pick to look at is one that
controls the US.
Twenty eight will be LEDs or radio pixels, strings of LEDs that are digitally controlled.
So these are early days.
Instead of having a analog signal to turn them on and off, actually have separate power connections
to them and then a digital signal which informs them what colors go on and what brightness.
So that's done by integrating control circuits with that RTP chip on the device itself.
You often find these chains into links as I've gotten in the picture there, sometimes into shapes as
well.
He's the third party library like this.
We need to actually include it some way in our code, so we going to create an additional folder underneath
our project directory called LEP.
And in there, we're going to put the picture of the library itself.
Peter Beattie Library comes from a guy called Foresight and yes, on GitHub, and I've given the link
there to his work.
I've added this library using Git Sub Module capability.
This means that it isn't truly part of my code.
It's just a link to a separate project from within my code.
This is the best way to do it within GIFs, though the way I've told you previously to clone the code
means that it hasn't pulled all of that module code in.
So we need to now go to the top level of our project structure and to issue the command GitHub module
updates from Python hyphen in it.
And that will bring down all of that code from the second so that we've got that code within our builds
ready to compile in the resources section.
Further reading.
There's a link to tutorials on using sub modules and how that works.
The schematics for this project looks a little bit more complicated, but it isn't too bad.
These devices are fairly simple.
They have full connections on a tight 12b to a power ground and positive charge.
And then you've got a signal in and a signal out that enables devices to be changed.
Now the signal in coming from all Peacock, we're going to connect that on to episode zero, which is
the first pin top left on a device.
We need to connect that with a resistor, according to the spec for both of us, take 12 base.
So I've put in that four hundred seventy I'm resistor in that the power we are going through the device,
we're going to pick directly off of the peak.
Now we're cheating a bit here.
Technically, these are five devices.
And if you use a five votes, then the signal must be five votes.
That would require that we had a level changing device in the circuit and a lot of additional complexity.
If you are running less than 10 LEDs off of the device, we can get away with just connecting into three
volts supply and controlling it on three volts.
It works.
It is a little bit of such fudge.
Everything is going on and off very quickly can change the amount of current they're drawing, and that
can cause an effect onto the Pico, providing that power.
To reduce that, we actually see a capacitor across the power circuit for the ladies.
And that's that thousand microfibre capacitor that is a polarized device.
So pleased to get it the right way round.
If you do get it wrong way around, it probably will explode quite loudly.
So please to be careful.
The picture at the library is technically C++, and so our main program, we are actually converting
to be C++ to call it.
We're going to include the standard exception library for C++, which is used by our Pico OLED library,
and the picture libraries had a file.
And then I'm going to put a couple of definitions in here around the pin that we're using to actually
control these leads, etc. and the length of my string of LEDs, which in my case is sent to set up
the library.
I just need to construct an object to have these three strip objects in this example.
I'm also going to create an array there of the colors of the rainbow, which is what I'm going to cycle
through as a loop.
So I'll loop itself is just to come through the colors of the rainbow and then repeat.
We then just fill the strip with the color from our rainbow till the strip to show.
Go to sleep for 500 milliseconds.
Pretty simple, but actually quite.
Effective to tell the build system to make this project, we're going to actually have to change.
Make false in the sources folder.
We need to, of course, include the main heap in the list of code making or executable.
And we need to tell it to link a new target library this time page our lady in the project folders.
See my list takes the file.
We need to do a few more changes.
The picture I need.
The library uses two special SDK capabilities.
It uses exceptions and RTI.
We need to turn this space on to an art to compile.
And then the library has a cimatu file, which gives the instructions for how to make that library ready
to link into to a project to build and deploy process exactly the same as we've done every other time.
So once you've put that on, we will have a heavy D strip that is changing colors through the rainbow,
as I'm showing here in the video.