Not quite sure how to get started with your Pimoroni Blinkt module? Let's set one up and have a play around! We'll guide you through the installation, open up some examples and try our hand at writing a simple program.
Today I'm going to show you how to set up your Pimoroni Blinkt module which is a strip of eight LEDs that just plugs straight onto your Raspberry Pi GPIO and gives you access to a really cheap, really effective display, for instance because the Raspberry Pi is web connected you might want to have this display various color LEDs for various statuses of email, Facebook notificationS, someone's mentioned you, ETC. Today I'm just going to show you how to download and install the relevant packages required to get blinkt running and we'll have a bit of a muck around with some examples. Let's get started.
So to start at the start here we have the Blinkt module and you should be able to see this rounded corner, I'll just make sure that is focused on the camera, we have a rounded corner on one, on both ends, of the module and they show you how the module should be plugged into the Raspberry Pi board so that rounded corner should match up with the corner by a Raspberry Pi 2 or 3B and if you're running a Raspberry Pi Zero then the other corner will be in line with the zeros corner as well. So we've got the module plugged in, I'm happy to power up now, and I'll see you in the future when my Pi has powered up. Ok welcome to the future, so the first thing that I need to do is install the relevant packages that the Blinkt module needs to operate so I can go to the go to the terminal and I need to run the following command which looks a little confusing but we'll go through step by step
fetches data from a server the server is
okay so curl fetches data from a server, that's the server, and this character pipe, which is the key that is above the enter or returns key, so you will press shift and the key that is above the enter key, pipe allows you to pass whatever data comes from that server into another command which is going to be bash, and bashes just a script interpreter or a command interpreter because what we're downloading is a script. So I'll strike enter and wait for that to proceed.
That was quick, so do you want to see what the script does before right now I'm pretty happy with that I just want to continue with it, yes, and an enter. Okay so now the script is checking the apt index to make sure they're all up-to-date they might have to download some packages so this might take a little while depending on how up to date your Pi is by the look of it.
So that was going for a couple minutes and now we're getting we're getting a couple of pieces of red text, I don't know if you saw those but we have unable to install RPI GPIO for Python 3 and the same thing for Python 2 now because Raspbian is packaged with these already, straight out of the box, I don't think that's the problem so I'm just going to say, yes I do want to install the packages and documentation. So I'm just going to just hit the Y key and we'll just keep in the back of our mind that our Python GPIO perhaps didn't install but I don't think that the problem. Downloading a bunch of Python packages, something failed and fell back on to PyPi, and okay so if it says all done until your blinkt, we do have some red text, again I'm not overly concerned at this point, let's just see if we can open an example and have a bit of a play.
So I should have mentioned this at the start but of course I was running this command from within my home directory, so I was in /home/pi just the default user home directory so if I close that shell session and open up my user directory, there I am, the Pimoroni directory has been created and we had inside that "Blinkt" so Pimoroni make a whole bunch of other stuff presumably you can download other pieces of software for other products and they will appear here as well. I'll open up Blinkt, and let's just get some instant gratification, let's get an example going. Let's open up graph now, I think this might run with Python 3, I think a few of them did not run with Python 3 straight away but they do with Python 2 so that has worked and hey, over on the bench there's your instant gratification we have this beautiful kind of purple organic-looking sinuous graph appearing now but that's a really nice effect you could use that as a as a nice all okay status indicator.
Okay enough of purple graph, let's close that example and open up another one, right next to it is Larson, so we can open that, and this is Python 3 as well, give it a run, okay this looks like your classic you know the very first thing anyone does with a strip of LEDs and that creates that that scanning Nightrider bar effect, maybe we can, maybe we can have a bit of a play with this one. So that's interesting so there's there's a big list and that looks like the brightness values for the LEDs and a kind of grabbing chunks of that list at a time, so we have the Delta, which is the offset, and the offset would be the offset for the so, sorry, if we're if we want to change the speed that this scans at then maybe we can just change that parameter to an eight instead of 16 and maybe that will 1/2...1/2 the speed or double the speed. It looks like it halved the speed. Okay, that's pretty cool, while we are here let's have a go at changing the colour. So pixels are set or displayed using set pixel and show. So the syntax for set pixel, and I will put this as a comment set pixel works as the position, the red, the green, and the blue, so position one through eight is the literal position of the LED on the strip and then we have the red green and blue values so you can see in the command up here we have some index which is in the range 1 to 8 that's just some loop that's setting all the pixels and we've got Reds offset plus I and then 0 0 so it looks like we're setting all red, no green, and no blue and that makes sense we've got only red lights so how about we shift that argument over and just put in a zero in front of it a comma of space and then I can delete the last argument. So now presumably this should give us a green Nightrider effect and yet there you have it so this it looks like this there's quite a lot of cool tricks packed into these examples that you can definitely learn a little from, you maybe need to brush up with Python or just programming, in general, there are some cool tricks in here.
So that wraps things up for this very short tutorial just wanted to show you how to install the relevant packages and get some instant gratification with your new Blinkt module so if you're wondering where to go to from here follow the links below Pimoroni has put together some really nice code along examples so you can learn how to get Blinkt up and running from scratch and I've also included a link to the function reference which is kind of like your manual on how all these functions work so you can use them properly. I'll catch you next time.