def main(): try: with Button(21, hold_time=0) as button: button.when_held = lambda: count_time(button) signal.pause() except KeyboardInterrupt: pass