filmov
tv
How to access GPIO pins of Raspberry Pi and Blink an LED using python

Показать описание
In the previous tutorial we had seen that "How to install python on Raspberry Pi". In this tutorial, let us see how we can access the GPIO pins on Raspberry Pi and Blink an LED using python program.
If you had followed my previous tutorials, then this will be an easy one for you.
If you don't get your Raspberry Pi detected in your laptop please watch my previous tutorial on "How to Connect Raspberry Pi to Laptop Display"
If you have not installed python on your raspberry pi, please watch my previous tutorial on "How to install Python on Raspberry Pi"
Connect the circuit as shown in the video and follow the steps accordingly. The CODE for Blink LED program is given below:
################################################
import RPi.GPIO as GPIO ## Import GPIO Library
import time ## Import 'time' library (for 'sleep')
pin = 7 ## We're working with pin 7
GPIO.setmode(GPIO.BOARD) ## Use BOARD pin numbering
GPIO.setup(pin, GPIO.OUT) ## Set pin 7 to OUTPUT
for i in range (0, 20): ## Repeat 20 times
GPIO.output(pin, GPIO.HIGH) ## Turn on GPIO pin (HIGH)
GPIO.output(pin, GPIO.LOW) ## Turn off GPIO pin (LOW)
GPIO.cleanup()
################################################
Sit back and enjoy this simple tutorial on accessing GPIO pins on Raspberry Pi and Blinking an LED using python program. : )
If you had any difficulties in the above steps, please comment below. We will try to solve your problem.
Please LIKE and SHARE the video if this tutorial worked for you.
Also don't forget to SUBSCRIBE to this channel to get more videos.
________________________________________________________________
MUSIC -- CREDITS
Song: Elektronomia - Sky High [NCS Release]
Music provided by NoCopyrightSounds.
________________________________________________________________
If you had followed my previous tutorials, then this will be an easy one for you.
If you don't get your Raspberry Pi detected in your laptop please watch my previous tutorial on "How to Connect Raspberry Pi to Laptop Display"
If you have not installed python on your raspberry pi, please watch my previous tutorial on "How to install Python on Raspberry Pi"
Connect the circuit as shown in the video and follow the steps accordingly. The CODE for Blink LED program is given below:
################################################
import RPi.GPIO as GPIO ## Import GPIO Library
import time ## Import 'time' library (for 'sleep')
pin = 7 ## We're working with pin 7
GPIO.setmode(GPIO.BOARD) ## Use BOARD pin numbering
GPIO.setup(pin, GPIO.OUT) ## Set pin 7 to OUTPUT
for i in range (0, 20): ## Repeat 20 times
GPIO.output(pin, GPIO.HIGH) ## Turn on GPIO pin (HIGH)
GPIO.output(pin, GPIO.LOW) ## Turn off GPIO pin (LOW)
GPIO.cleanup()
################################################
Sit back and enjoy this simple tutorial on accessing GPIO pins on Raspberry Pi and Blinking an LED using python program. : )
If you had any difficulties in the above steps, please comment below. We will try to solve your problem.
Please LIKE and SHARE the video if this tutorial worked for you.
Also don't forget to SUBSCRIBE to this channel to get more videos.
________________________________________________________________
MUSIC -- CREDITS
Song: Elektronomia - Sky High [NCS Release]
Music provided by NoCopyrightSounds.
________________________________________________________________
Комментарии