Add scp and pic taking to cam
This commit is contained in:
parent
fe71e3400a
commit
50be58e0c8
@ -1,22 +1,47 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import time
|
||||
import time, subprocess
|
||||
import RPi.GPIO as GPIO
|
||||
|
||||
from SCP import scp
|
||||
|
||||
IR_PIN = 3
|
||||
|
||||
GPIO.setmode(GPIO.BOARD)
|
||||
GPIO.setup(IR_PIN, GPIO.OUT)
|
||||
|
||||
i = 0
|
||||
try:
|
||||
while True:
|
||||
print "Gpio Low"
|
||||
GPIO.output(IR_PIN, GPIO.LOW)
|
||||
time.sleep(20)
|
||||
print "Gpio High"
|
||||
print("Gpio Low")
|
||||
GPIO.output(IR_PIN, GPIO.HIGH)
|
||||
time.sleep(20)
|
||||
time.sleep(2)
|
||||
|
||||
# take image and scp it to the other pi
|
||||
print("take image...")
|
||||
subprocess.run(['raspistill', '-o', 'images/image' + str(i) + '.jpg'])
|
||||
|
||||
print("transfer image")
|
||||
#scp('images/image' + str(i) + '.jpg', '~/image' + str(i) + '.jpg', '192.168.252.1', 'pi', 'smarthome')
|
||||
|
||||
i+=1
|
||||
|
||||
if i>10:
|
||||
break
|
||||
#print("Gpio High")
|
||||
#GPIO.output(IR_PIN, GPIO.HIGH)
|
||||
#time.sleep(2)
|
||||
|
||||
# take image and scp it to the other pi
|
||||
#print("take image...")
|
||||
#subprocess.run(['raspistill', '-o', 'image2.jpg'])
|
||||
|
||||
#print("transfer image")
|
||||
#scp('image2.jpg', '~/image2.jpg', '192.168.252.1', 'pi', 'smarthome')
|
||||
|
||||
#break
|
||||
|
||||
except Exception as e:
|
||||
print e
|
||||
print(e)
|
||||
finally:
|
||||
GPIO.cleanup()
|
||||
|
Loading…
x
Reference in New Issue
Block a user