HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

How to Blink LED using Raspberry pi 4 | Python Script

12,561 views November 1, 2019 4:24

Watch on YouTube
ChannelRobotica DIY

Description from the creator

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)
amzn.to/2noWmWm (Raspberry pi 4 model B)
amzn.to/2nm0d6x (Raspberry pi 4 power supply)
amzn.to/2APAvuf (Dual fan heat sink aluminium armor Raspberry Pi 4 case) Optional
amzn.to/2mIHAJF (microSD card)
amzn.to/2vSpUON (LED)
amzn.to/2wxPmWz (Breadboard)
amzn.to/2vJ3lvo (Jumper wire)
amzn.to/2vmSK8l (Resistor)


Song: Extenz - Gravity (Vlog No Copyright Music)
Music provided by Vlog No Copyright Music.
Video Link: youtu.be/Dqads4X-WuQ

1) gpiozero

#blinking with gpiozero library
from gpiozero import LED
from time import sleep
led = LED(23)
while True:
led.on()
print('LED ON')
sleep(1)
led.off()
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')
time.sleep(1)
GPIO.output(ledPin, GPIO.LOW)
print('LED OFF')
time.sleep(1)

About this tutorial

Robotica DIY published this 4:24 video tutorial on November 1, 2019. It has been watched 12,561 times on YouTube.

Duration
4:24
Published
November 1, 2019
Views
12,561
Likes
135

Tags

Share

This tutorial in other languages