Soldering
This commit is contained in:
@@ -1,26 +0,0 @@
|
|||||||
import RPi.GPIO as GPIO
|
|
||||||
import time
|
|
||||||
|
|
||||||
# photo sensor on PIN 4
|
|
||||||
GPIO.setmode(GPIO.BCM)
|
|
||||||
GPIO.setup(4, GPIO.IN)
|
|
||||||
|
|
||||||
# LED on PIN 17
|
|
||||||
GPIO.setup(17, GPIO.OUT)
|
|
||||||
GPIO.output(17, GPIO.LOW)
|
|
||||||
|
|
||||||
try:
|
|
||||||
print('Start sensor test')
|
|
||||||
|
|
||||||
while True:
|
|
||||||
time.sleep(0.25)
|
|
||||||
if (GPIO.input(4) == GPIO.LOW):
|
|
||||||
print('LOW')
|
|
||||||
GPIO.output(17, GPIO.LOW)
|
|
||||||
else:
|
|
||||||
print('HIGH')
|
|
||||||
GPIO.output(17, GPIO.HIGH)
|
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print('bye')
|
|
||||||
GPIO.cleanup()
|
|
||||||
@@ -3,10 +3,10 @@ import time
|
|||||||
|
|
||||||
GPIO.setwarnings(False)
|
GPIO.setwarnings(False)
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
GPIO.setup(24, GPIO.OUT)
|
GPIO.setup(22, GPIO.OUT)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
GPIO.output(24, True)
|
GPIO.output(22, True)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
GPIO.output(24, False)
|
GPIO.output(22, False)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
import time
|
|
||||||
|
|
||||||
GPIO.setmode(GPIO.BOARD)
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
|
||||||
GPIO.setup(11,GPIO.OUT)
|
GPIO.setup(27,GPIO.OUT)
|
||||||
GPIO.output(11,GPIO.LOW)
|
GPIO.output(27,GPIO.LOW)
|
||||||
|
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
import time
|
|
||||||
|
|
||||||
GPIO.setmode(GPIO.BOARD)
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
|
||||||
GPIO.setup(11,GPIO.OUT)
|
GPIO.setup(27,GPIO.OUT)
|
||||||
GPIO.output(11,GPIO.HIGH)
|
GPIO.output(27,GPIO.HIGH)
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -1,25 +1,25 @@
|
|||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
import time
|
import time
|
||||||
|
|
||||||
# photo sensor on PIN 4
|
# photo sensor on PIN 17
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
GPIO.setup(4, GPIO.IN)
|
GPIO.setup(17, GPIO.IN)
|
||||||
|
|
||||||
# LED on PIN 17
|
# LED on PIN 27
|
||||||
GPIO.setup(17, GPIO.OUT)
|
GPIO.setup(27, GPIO.OUT)
|
||||||
GPIO.output(17, GPIO.LOW)
|
GPIO.output(27, GPIO.LOW)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print('Start sensor test')
|
print('Start sensor test')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
time.sleep(0.25)
|
time.sleep(0.25)
|
||||||
if (GPIO.input(4) == GPIO.LOW):
|
if (GPIO.input(17) == GPIO.LOW):
|
||||||
print('LOW')
|
print('LOW')
|
||||||
GPIO.output(17, GPIO.LOW)
|
GPIO.output(27, GPIO.LOW)
|
||||||
else:
|
else:
|
||||||
print('HIGH')
|
print('HIGH')
|
||||||
GPIO.output(17, GPIO.HIGH)
|
GPIO.output(27, GPIO.HIGH)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('bye')
|
print('bye')
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 222 KiB |
Reference in New Issue
Block a user