![]() Remember, if reading this Python script feels like deciphering hieroglyphs for you, you will benefit from reading my book “ Master Python on Raspberry Pi“. From there, I can set it on or off with:.Then, I define the LED name (26 in my example), and initialize it as an output with:.I start with two initialization steps, especially setting GPIO.BCM, which means we’ll use the port “name” instead of the pin “numbers” (GPIO.BOARD).Other solutions are possible, but let’s use this one as an example. I use RPi.GPIO (a pre-installed Python library).In Python, the full script will look like this: import RPi.GPIO as GPIO ![]() If you want to try this simple circuit on your own, read my GPIO guide for beginners, as I think I use something very similar in it (maybe not the same pins, but it’s a good exercise anyway).
0 Comments
Leave a Reply. |