import time
from Lights import *
from Buzzer import *
time.sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
class Scanner:
def scanBarcode(self, prompt = 'Scan code: ')->str:
return input(prompt)
if __name__ == '__main__':
myscanner = Scanner()
myled = Light(0, "Redled")
mybuzzer = PassiveBuzzer(26)
while True:
barcode = myscanner.scanBarcode()
if barcode:
myled.on()
mybuzzer.beep()
myled.off()
print(f'Code scanned is {barcode}')
else:
# Quit if no barcode is scanned - so just hit return at the scan code
# prompt if you want a way to come out of the scan mode
break