-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreview.py
More file actions
executable file
·53 lines (49 loc) · 1.97 KB
/
preview.py
File metadata and controls
executable file
·53 lines (49 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## Function and variable file for the climbing assay
## Written August 5, 2021 by Adam Spierer
## Adapted from an earlier script written on July 7, 2015 by Adam Spierer
##
## --> Make sure to modify the `define_variables` function on lines 36 - 59
## before running the main climbing_assay.py script.
##
## This script is not essential or called in the climbing_assay script.
## It is useful for getting a visual on the rig when setting up the assay.
##########################################################################
## Import modules
import time
import spidev
import picamera
import RPi.GPIO as GPIO
##########################################################################
## Define variable
move_on = False
##########################################################################
## Define functions
def previewer():
''''''
delay_time = 0.00001
capture = delay_time
while capture != 0:
camera.resolution = (1280, 960)
camera.rotation = 180
camera.start_preview()
time.sleep(int(capture))
camera.stop_preview()
capture = input("Live view for how many seconds??: ")
if capture == '' or capture == '0':
break
def print_opener():
'''Prints opening statements when the program is first run'''
print("\n\nWelcome to preview.py!")
print(" - The goal of this script is to view the Raspberry Pi camera image...")
print(" - Ensure image is framed correctly and there is no 'banding' pattern...")
print(" - If banding, hold the power icon on the lightboard to adjust until gone...")
print("\nTo use:")
print(" - Enter the number of seconds to view for...")
print(" - When you are finished, press <enter> to exit the program...")
print("\n~~Happy viewing~~\n\n")
return
##########################################################################
## Running the camera
with picamera.PiCamera() as camera:
while move_on == False:
move_on = previewer()