import time import board import analogio import digitalio import neopixel led = digitalio.DigitalInOut(board.LED) led.direction = digitalio.Direction.OUTPUT led.value = True #Turn led on so we know when device is on pixel = neopixel.NeoPixel(board.NEOPIXEL, 1) #Onboard neopixel pixel.brightness = 0.3 potentiometer = analogio.AnalogIn(board.A0) #Foot Pedal potentiometer shutter = digitalio.DigitalInOut(board.D25) shutter.direction = digitalio.Direction.OUTPUT focus = digitalio.DigitalInOut(board.D24) focus.direction = digitalio.Direction.OUTPUT shutter.value = True focus.value = True while True: timer = 0 if potentiometer.value > 9000: #Full press of foot pedal print("picture") shutter.value = False pixel.fill((0, 255, 0)) time.sleep(1) shutter.value = True pixel.fill((0, 0, 0)) while potentiometer.value < 8000 and potentiometer.value > 5000: #Half press of foot pedal if timer >= 3: #Starts focusing camera after beign pressed for short time print("focus") focus.value = False pixel.fill((255, 255, 255)) #Turn Neopixel white time.sleep(0.5) focus.value = True pixel.fill((0, 0, 0)) #Neopixel off print(potentiometer.value) pixel.fill((255, 0, 0)) time.sleep(0.25) pixel.fill((0, 0, 0)) time.sleep(0.25) timer = timer + 1 print(timer)