Getting Started with GPIO Pins on Raspberry Pi (Beginners ...
raspberrytips.com › raspberry-pi-gpio-pinsPaste these lines inside: #import libraries import RPi.GPIO as GPIO import time #GPIO Basic initialization GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) #Use a variable for the Pin to use #If you followed my pictures, it's port 7 => BCM 4 led = 4 #Initialize your pin GPIO.setup(led,GPIO.OUT) #Turn on the LED print "LED on" GPIO.output(led,1) #Wait 5s time.sleep(5) #Turn off the LED print "LED off" GPIO.output(led,0)
RPi GPIO Code Samples - eLinux.org
https://elinux.org/RPi_GPIO_Code_Samples15.12.2020 · Direct register access. Gert van Loo & Dom, have provided some tested code which accesses the GPIO pins through direct GPIO register manipulation in C-code. (Thanks to Dom for doing the difficult work of finding and testing the mapping.) Note: For Raspberry Pi 2 and Pi 3, change BCM2708_PERI_BASE to 0x3F000000 for the code to work.