Загрузка страницы

DIY Aquarium Controller - Getting Started with the Raspberry Pi GPIO

Emmanuel Lopez's DIY Raspberry Pi ATO Project
https://youtu.be/4wthgMDGZpo

Source Code used in this video:
========================================

import RPi.GPIO as GPIO
import time

#define the LED pins
led_pin_green = 40
led_pin_yellow = 38
led_pin_red = 37

GPIO.setmode(GPIO.BOARD)
GPIO.setup(led_pin_green, GPIO.OUT)
GPIO.setup(led_pin_yellow, GPIO.OUT)
GPIO.setup(led_pin_red, GPIO.OUT)

try:
while True:
#blink green led
GPIO.output(led_pin_green,True)
print("Green led ON")
time.sleep(.5)
GPIO.output(led_pin_green,False)

#blink yellow led
GPIO.output(led_pin_yellow,True)
print("Yellow led ON")
time.sleep(.5)
GPIO.output(led_pin_yellow,False)

#blink red led
GPIO.output(led_pin_red,True)
print("Red led ON")
time.sleep(.5)
GPIO.output(led_pin_red,False)

except KeyboardInterrupt:
#turn leds OFF
GPIO.output(led_pin_green,False)
GPIO.output(led_pin_yellow,False)
GPIO.output(led_pin_red,False)
print("Keyboard interrupt, turn off all leds")

finally:
GPIO.cleanup()
print("clean up GPIO. Exiting program, Goodbye!!")

Видео DIY Aquarium Controller - Getting Started with the Raspberry Pi GPIO канала ReefSpy
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
6 октября 2017 г. 0:05:36
00:26:43
Яндекс.Метрика