简体   繁体   中英

Camera will not shut off in my loop

I'm following the article here but it seems that when I run this loop the camera does not shut off, and requires me to manually power down the unit to get out of the program. Even holding down ctrl + alt + t does not exit the program.

Any help would be greatly appreciated.

camera.start_preview()
for i in range(5):
    sleep(5)
    camera.capture('/home/pi/Desktop/image%s.jpg' % i)
camera.stop_preview()

Adding camera.close() does not help.

camera.start_preview()
for i in range(5):
    sleep(5)
    camera.capture('/home/pi/Desktop/image%s.jpg' % i)
camera.stop_preview()
camera.close()

Have you tried to do the following without anything else?

camera.start_preview() 
camera.close()

It should do the trick

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM