From c2d61105760a879f45be7fedf0b7bc3e35482fc6 Mon Sep 17 00:00:00 2001 From: bton Date: Wed, 17 Apr 2024 19:03:48 +0200 Subject: [PATCH] test --- NFC_Reader.py | 4 ++-- oled.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NFC_Reader.py b/NFC_Reader.py index df200a6..9db376e 100644 --- a/NFC_Reader.py +++ b/NFC_Reader.py @@ -2,8 +2,8 @@ import time import nfc import subprocess import requests -import asyncio import oled +from threading import Thread url="http://172.16.1.105/api/" @@ -21,7 +21,7 @@ def onTagSense(tag): response = requests.post(f"{url}tag_id", data={"id":id}) try: if response.json()["mode"] == "balance" or response.json()["mode"] == "message": - #oled.Balance(response.json()["username"], response.json()["balance"]) + # subprocess? Thread(target=oled.Balance, args=(response.json()["username"], response.json()["balance"])).run() return True except: None diff --git a/oled.py b/oled.py index 413502f..1cc6ac9 100644 --- a/oled.py +++ b/oled.py @@ -18,5 +18,10 @@ async def Balance(user_name, balance): await time.sleep(5) await clear() +def Error(code): + clear() + display.text("!!!!ERROR!!!!", 50, 0 (255,255,255), size=2) + display.text(str(code), 50, 10, (255,255,255), size=2) + if __name__ == "__main__": Balance("Test", -255555)