Smart-Home am Beispiel der Präsenzerkennung im Raum Projektarbeit Lennart Heimbs, Johannes Krug, Sebastian Dohle und Kevin Holzschuh bei Prof. Oliver Hofmann SS2019
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.

camera.py 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env python3
  2. import time, subprocess
  3. import RPi.GPIO as GPIO
  4. from SCP import scp
  5. IR_PIN = 3
  6. GPIO.setmode(GPIO.BOARD)
  7. GPIO.setup(IR_PIN, GPIO.OUT)
  8. i = 0
  9. try:
  10. while True:
  11. print("Gpio Low")
  12. GPIO.output(IR_PIN, GPIO.HIGH)
  13. time.sleep(2)
  14. # take image and scp it to the other pi
  15. print("take image...")
  16. subprocess.run(['raspistill', '-o', 'images/image' + str(i) + '.jpg'])
  17. print("transfer image")
  18. #scp('images/image' + str(i) + '.jpg', '~/image' + str(i) + '.jpg', '192.168.252.1', 'pi', 'smarthome')
  19. i+=1
  20. if i>10:
  21. break
  22. #print("Gpio High")
  23. #GPIO.output(IR_PIN, GPIO.HIGH)
  24. #time.sleep(2)
  25. # take image and scp it to the other pi
  26. #print("take image...")
  27. #subprocess.run(['raspistill', '-o', 'image2.jpg'])
  28. #print("transfer image")
  29. #scp('image2.jpg', '~/image2.jpg', '192.168.252.1', 'pi', 'smarthome')
  30. #break
  31. except Exception as e:
  32. print(e)
  33. finally:
  34. GPIO.cleanup()