pool = socketpool.SocketPool(wifi.radio) print("Connecting to Adafruit IO") mqtt_client = MQTT.MQTT( broker="io.adafruit.com", username=secrets["aio_username"], password=secrets["aio_key"], socket_pool=pool, ssl_context=ssl.create_default_context(), ) mqtt_client.connect() io = IO_MQTT(mqtt_client) # Blank out any previously published message io.publish(feed_name, "\ufeff") qrdecoder = qrio.QRDecoder(cam.width, cam.height) bitmap = displayio.Bitmap(cam.width, cam.height, 65536) # Create a greyscale palette pal = displayio.Palette(256) for i in range(256): pal[i] = 0x10101 * i label = Label( font=FONT, text="Scan QR Code...", color=0xFFFFFF, background_color=0x0, padding_top=2, padding_left=2, padding_right=2,
try: import qrio except: print("SKIP") raise SystemExit loc = __file__.rsplit("/", 1)[0] with open(f"{loc}/data/qr.pgm") as f: content = f.read()[-320 * 240 :] decoder = qrio.QRDecoder(320, 240) for r in decoder.decode(content): print(r)