Everything worked perfectly fine for me..
but I don't know how to view the captured images in rpi...
So Can Anyone tell me how to view the captured images
Code: Select all
import RPi.GPIO as GPIO
import time
import picamera # new
sensor = 4
GPIO.setmode(GPIO.BCM)
GPIO.setup(sensor, GPIO.IN, GPIO.PUD_DOWN)
previous_state = False
current_state = False
cam = picamera.PiCamera() # new
while True:
time.sleep(0.1)
previous_state = current_state
current_state = GPIO.input(sensor)
if current_state != previous_state:
new_state = "HIGH" if current_state else "LOW"
print("GPIO pin %s is %s" % (sensor, new_state))
if current_state: # new
cam.start_preview()
else:
cam.stop_preview()