Want to use the GPIO pins to blink an LED using a Raspberry Pi Zero? Here’s a quick guide to get you started.
Build the circuit
Do this is the Raspberry Pi off. You don’t want to accidentally touch the wrong pin on the Pi and fry the Pi.
Use http://pinout.xyz to check the pinouts of the Raspberry Pi.
Create a circuit that goes from GND to LED to resistor to GPIO pin (BCM).
Install the Python Library
We’ll be using python to build our program so first download the python library. There is an api to interface with the GPIO pins which makes this a lot easier.
|
https://gpiozero.readthedocs.io/ for more information on this library.
Create the Program
Now create a file called blink.py
and put the following in it:
|
Run the Program
Run the program with the following command:
|
If all went well you should now see your LED blinking!
References
https://gpiozero.readthedocs.io/
https://www.raspberrypi.org/blog/gpio-zero-a-friendly-python-api-for-physical-computing/
Comments