File size: 624 Bytes
ffc4bf2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# -*- coding: utf-8 -*-
"""eblis.195
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1jQewaOs4k_FeO2e0CogHm-QX34vGZBwf
"""
from time import sleep
import RPi.GPIO as GPIO
delay = .1
inPin = 40
outPin = 38
GPIO.setmode(GPIO.BOARD)
GPIO.setup(outPin,GPIO.OUT)
GPIO.setup(inPin,GPIO.IN,pull_up_down=GPIO.PUD_UP)
try:
while True:
readVal=GPIO.input(inPin)
print(readVal)
if readVal==1:
GPIO.output(outPin)
if readVal==0:
GPIO.output(outPin, GPIO.HIGH)
sleep(delay)
except KeyboardInterrupt:
GPIO.cleanup()
print("Ready to Perform") |