Raspberry Pi LED blinking python coding and simulation

Опубликовано: 12 Август 2020
на канале: D-code 103
1,072
10

Raspberry Pi LED blinking simulation

For more information
https://dasjeeprojectsolutions.busine...

coding in python

To initialize the GPIO ports on the Raspberry Pi we need to first import the Python library, initialize the library and setup pin 8 as an output pin.
///////////////////////////////////////////

import RPi.GPIO as GPIO
Import Raspberry Pi GPIO library
from time import sleep
Import the sleep function from the time module
GPIO.setwarnings(False)
Ignore warning for now GPIO.setmode(GPIO.BOARD)
Use physical pin numbering
GPIO.setup(8, GPIO.OUT, initial=GPIO.LOW) # Set pin 8 to be an output pin and set initial value to low (off)

///////////////////////////
Next we need to turn the LED on and off in 1 second intervals by setting the output pin to either high (on) or low (off). We do this inside a infinite loop so our program keep executing until we manually stop it.

//////////////////

while True:
Run forever
GPIO.output(8, GPIO.HIGH)
PIN 8 is on logic highTurn on
sleep(1)
Sleep for 1 second delay 1second


GPIO.output(8, GPIO.LOW)
Turn off
sleep(1)
Sleep for 1 second

//////////////

for more information write a comment

https://dasjeeprojectsolutions.busine...


На этой странице сайта вы можете посмотреть видео онлайн Raspberry Pi LED blinking python coding and simulation длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь D-code 103 12 Август 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,072 раз и оно понравилось 10 зрителям. Приятного просмотра!