I have a TouchPhat and Noir camera attached to a PiZero w. I am attempting to take a still photo with the press of one button and a short video with another. The Python script I have attempted is below. I am getting a Syntax error on the ‘def my_function()’ line and I cannot fathom why.
Here is the full script. Excuse my ignorance as this is my first attempt at Python
import touchphat import time import picamera camera = picamera.PiCamera() while True: @touchphat.on_touch("A") def my_function() touchphat.led_on("A") camera.capture('image.jpg') touchphat.led_off("A") @touchphat.on_touch("B") def my_functiona() touchphat.led_on("B") camera.start_recording('video.h264') sleep(10) camera.stop_recording() touchphat.led_off("B") except KeyboardInterrupt(): sys.exit()
Thanks in advance for any help on this