update infinfrared, monitored, sht20, ds18b20 python code
old mode 100644
new mode 100755
old mode 100644
new mode 100755
| | |
| | | #!/usr/bin/python |
| | | #-*- coding: utf-8 -*- |
| | | |
| | | import time |
| | | import signal |
| | | import RPi.GPIO as GPIO |
| | | |
| | | INFR_PIN=16 |
| | | # I/O Pin connected to Physical PIN#16, BCM code pin number is 20 and wPi pin number is 28 |
| | | INFR_PIN=20 |
| | | |
| | | def sig_proc(signum, frame): |
| | | print("Catch stop signal and program exit now...") |
| | |
| | | |
| | | def init(): |
| | | GPIO.setwarnings(False) |
| | | GPIO.setmode(GPIO.BOARD) |
| | | GPIO.setmode(GPIO.BCM) |
| | | GPIO.setup(INFR_PIN, GPIO.IN) |
| | | pass |
| | | |
old mode 100644
new mode 100755
| | |
| | | #!/usr/bin/python |
| | | #-*- coding: utf-8 -*- |
| | | |
| | | import fcntl |
| | | import time |
| | | import unittest |
| | |
| | | from pygame.locals import * |
| | | from ftplib import FTP |
| | | |
| | | RELAY_OFF_TIMEOUT=15 |
| | | |
| | | ON=1 |
| | | OFF=0 |
| | | |
| | | # I/O Pin connected to PIN#16, BCM code pin number is 23 and wPi pin number is 4 |
| | | infrared_pin=16 |
| | | # I/O Pin connected to Physical PIN#16, BCM code pin number is 20 and wPi pin number is 28 |
| | | infrared_pin=20 |
| | | |
| | | # I/O Pin connected to PIN#12, which can set be PWM mode |
| | | # I/O Pin Not Connected |
| | | buzzer_pin=12 |
| | | |
| | | # I/O Pin connected to PIN#18, BCM code pin number is 24 and wPi pin number is 5 |
| | | relay_pin=18 |
| | | # I/O Pin connected to Physical PIN#40, BCM code pin number is 21 and wPi pin number is 29 |
| | | relay_pin=21 |
| | | |
| | | capture_times=2 |
| | | local_image="rpi_capture.jpg" |
| | |
| | | |
| | | #Raspberry Python GPIO Initialise |
| | | GPIO.setwarnings(False) |
| | | GPIO.setmode(GPIO.BOARD) |
| | | GPIO.setmode(GPIO.BCM) |
| | | |
| | | # Initialise infrared GPIO port |
| | | GPIO.setup(infrared_pin, GPIO.IN) |
| | |
| | | #turn_buzzer_on() |
| | | |
| | | turn_relay(ON) |
| | | signal.alarm(30) |
| | | signal.alarm(RELAY_OFF_TIMEOUT) |
| | | |
| | | camera = pygame.camera.Camera("/dev/video0",(1024,768)) |
| | | camera.start() |