In my quest to use a Raspberry Pi 3B+ for creating art, I need to be able to control the GPIO pins. So next step
was to look for some information on doing just that.
A quick search of element14 uncovered this blog by shabaz where he illustrates controlling the GPIO lines with
Python. That should get me off to a quick start and Python should be ok to work with, at least for the simpler
art pieces [I haven't done very much with Python and, to be honest, I didn't entirely like it when I did, but it
will do for the moment].
To enter the script I'm going to need a text editor that I can run without the desktop. It seems that GNU Nano
is part of the distribution, so I'll start with that. For it to work with PuTTY, I found that local editing
needed to be turned off.
Here's the Python code I'm using, as seen in the Nano editor's text-terminal-style 'window', framed in PuTTY's
Windows GUI-style window. The code is one of Shabaz's examples.
If I give it to the Python interpreter to run and look at the IO pin, it does this on the 'scope
Success!
So, I now have the means to control I/O lines under the control of a Python script and that probably gives me
enough to get me going and produce the first simple piece of art (which I've got to come up with by the end of next
week to stay on schedule). Next blog will be the first proper challenge one and will be in the Picasso Challenge
area.
Top Comments