From 7e3787053ab7a174cbc0cdf29415bd17dfd017ff Mon Sep 17 00:00:00 2001 From: Nicolas Bertrand Date: Thu, 7 Nov 2024 17:15:07 +0100 Subject: [PATCH] 1st Leds try --- requirements.txt | 6 ++++++ scanner.py | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d007bb1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +Flask +pillow +opencv-python +gphoto2 +gpiozero +scipy diff --git a/scanner.py b/scanner.py index 142e9b4..c58175e 100644 --- a/scanner.py +++ b/scanner.py @@ -4,7 +4,7 @@ from os.path import join import shutil import time import gphoto2 as gp - +from gpiozero import PWMLED from . import config # Delay between to captures @@ -34,16 +34,19 @@ def capture(output_path: str) -> bool: def scan(output_dir: str): os.makedirs(output_dir, exist_ok=True) - for led in config.LEDS_UUIDS: - print(f'Turn on {led}') + gpio= PWMLED(17) + gpio.value = 0 + for count,led in enumerate(config.LEDS_UUIDS): + print(f'Turn on {count} {led}') img = join(output_dir, led + '.jpg') # Measure the time it takes to capture start = time.time() - + gpio.value = count/len(config.LEDS_UUIDS) capture(img) # For debug purposes #shutil.copyfile(join('data-keep/small', led + '.jpg'), img) + gpio.value = 0 delta = time.time() - start @@ -51,5 +54,5 @@ def scan(output_dir: str): if delta < DELAY: time.sleep(DELAY - delta) - print(f'Turn off {led}') + print(f'Turn off {count} {led}') yield led