DIGITAL OUTPUT – RASPBERRY PI

Photo of author

By Jackson Taylor

GPIO layout

  • uses raspberry pi physical pinout

TURN ON LED ON THE 40th PIN
import RPi.GPIO as gpio #adds header file
gpio.setmode(gpio.BOARD)            #sets as the pin number in board
gpio.setwarnings(False)        #disable warnings
gpio.setup(40,gpio.OUT) #set 40 pin as output
gpio.output(40,1)          #writes a digital value to it
TURN OFF LED ON THE 40th PIN
import RPi.GPIO as gpio #adds header file
gpio.setmode(gpio.BOARD)    #sets as the pin number in board
gpio.setwarnings(False)   #disable warnings
gpio.setup(40,gpio.OUT) #set 40 pin as output
gpio.output(40,0)        #writes a digital value to it