from machine import Pin,ADC import time but = Pin(15,Pin.IN) ldr = ADC(Pin(26)) state = True while state: ldr_val = ldr.read_u16() time.sleep(0.1) print(ldr_val) if but.value(): print(f"Captured={ldr_val}") state = False