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