How to Blink LED using Raspberry pi 4 | Python Script

preview_player
Показать описание
How to Blink LED using Raspberry pi 4 | Python Script. we will also make LED blink using gpiozero and RPi.GPIO library.
Scroll down for code.....

Please like & Subscribe for more videos

If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.

LIST OF COMPONENT (affiliate links)

Song: Extenz - Gravity (Vlog No Copyright Music)
Music provided by Vlog No Copyright Music.

1) gpiozero

#blinking with gpiozero library
from gpiozero import LED
from time import sleep
led = LED(23)
while True:
print('LED ON')
sleep(1)
print('LED OFF')
sleep(1)

2) Rpi.GPIO

#blink with RPi.GPIO library
import RPi.GPIO as GPIO
import time
ledPin = 16
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(ledPin,GPIO.OUT)

while True:
GPIO.output(ledPin, GPIO.HIGH)
print('LED ON')
GPIO.output(ledPin, GPIO.LOW)
print('LED OFF')
Рекомендации по теме
Комментарии
Автор

This covers all the questions i was having, all up to date. I never knew about the difference between BCM and board. Good video

gumbo
Автор

hey nice video, but if you explain more about circuit it would have been great. Now I am not sure which pins and what is the resistance and how much voltage the led can bare.

gsateesh
Автор

Can you show how to code this without a loop by creating a class?

williamwarren
join shbcf.ru