Skip to content
ivmech edited this page Dec 19, 2014 · 6 revisions

Sample python script ivport_capture_A.py is switching camera with using GPIO levels one by one in loop that captures with using raspistill. Before using it, required dependency python-rpi.gpio have to be installed with sudo apt-get install python-rpi.gpio command from the Terminal.

...
def main():
    gp.output(7, False)
    gp.output(11, False)
    gp.output(12, True)
    capture(1)

    gp.output(7, True)
    gp.output(11, False)
    gp.output(12, True)
    capture(2)

    gp.output(7, False)
    gp.output(11, True)
    gp.output(12, False)
    capture(3)

    gp.output(7, True)
    gp.output(11, True)
    gp.output(12, False)
    capture(4)

def capture(cam):
    cmd = "raspistill -o capture_%d.jpg" % cam
    os.system(cmd)
...

Starting Ivport Switching

Therefore it can be started with sudo python ivport_capture_A.py from the Terminal;

It saves capture_1.jpg, capture_2.jpg, capture_3.jpg, capture_4.jpg to working directory.

Example 4

Clone this wiki locally