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.
You'll need:
- A Raspberry Pi (I'm using a Pi 3 B) running the latest version of Raspbian
- A Blinkt module
Installation
Make sure you're in your /home/pi directory, execute cd
Installation is a one-liner. Execute:
curl https://get.pimoroni.com/blinkt | bash
Ok, but what's going on? curl fetches data (a script) from a server, the pipe ( | ) passes ("pipes") the data into bash, which execuetes the script.
Following the prompts for the setup procedure, you may encounter some scary red-text saying something to the effect of Unable to install RPi.GPIO for python 2 / 3. That's ok, I got that to. It doesn't appear to be anything to worry about because the latest versions of Raspbian come with RPi.GPIO included.
Enter y to perform the full install. I get a notcie that some packages could not be installed. Reviewing the output is quite cryptic, but pressing on, this hasn't been a problem for me.
With all that complete, we're ready to play around with our Blinkt.
Open an Example
The examples provided are overflowing with cool programming tricks. If you're new to Python or programming in general there's a lot to be learned just by stepping through these programs or hacking them to do things differently.
navigate to ~/Pimoroni/blinkt/examples
At the time of writing, some scripts don't run with Python 3 without some slight modification. If you try to run an script and it doesn't work, try using Python 2.
Open:
- graph.py and marvel at the smooth, sinuous led show.
- larson.py to experience a classic led effect - the scanning bar from Knightrider
Where to from here?
- The function reference is your manual for how to use the blinkt functions correctly
- Pimoroni's own tutorial has some great code-along examples if you need to brush up on your Python programming.
- For the adventurous that want to get their Blinkt connected to the web:There's the mqtt.py script in the examples directory, and I've written a Getting Started with MQTT tutorial if you need help getting started. Some comments in mqtt.py point you to a free mqtt testing website.