03/26/2023
Controlling Raspberry Pi GPIO On/Off
Writing about Controlling Raspberry Pi GPIO On/Off for educational and informational purposes only. however, do not hesitate to use this information on your own risk as we make no warranty of any kind.
Simple way to control a Raspberry Pi GPIO using Python.
#import the GPIO package
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
#I'm using pin 8 here but you can use any pin you like
GPIO.setup(8, GPIO.OUT)
GPIO.output(8,True) #You can also do GPIO.output(8, GPIO.HIGH)
GPIO.output(8,False) #You can also do GPIO.output(8, GPIO.LOW)
GPIO.cleanup()