You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
612 B
25 lines
612 B
#!/usr/bin/python
|
|
# encoding:utf-8
|
|
import RPi.GPIO as GPIO
|
|
import time
|
|
import jiqiren as jqr
|
|
|
|
|
|
|
|
def hy():
|
|
pin_fire = 18
|
|
GPIO.setmode(GPIO.BCM)
|
|
GPIO.setup(pin_fire, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
|
|
for i in range(5):
|
|
status = GPIO.input(pin_fire)
|
|
if status == True:
|
|
# print('没有检测到火')
|
|
continue
|
|
else:
|
|
print('检测到火灾')
|
|
for i in range(3):
|
|
jqr.Key('请注意!检测到火灾!')
|
|
GPIO.cleanup(pin_fire)
|
|
break
|
|
GPIO.cleanup(pin_fire)
|