HC-SR501
Jump to navigation
Jump to search
Judesio daviklis.
Sujungimas
Visi pinai aprašyti čia. Sujungimas:
VVC = PIN 2 OUTPUT = PIN 7 GND = PIN 6
Kodas
from time import sleep
from pyA20.gpio import gpio
from pyA20.gpio import port
mq135 = port.PA6
gpio.init()
gpio.setcfg(mq135, gpio.INPUT)
try:
while True:
state = gpio.input(mq135)
sleep(0.2)
print "Statusas: %d"%state
except KeyboardInterrupt:
print ("Goodbye.")