This commit is contained in:
bton 2024-04-17 19:03:48 +02:00
parent 80219414c7
commit c2d6110576
2 changed files with 7 additions and 2 deletions

View file

@ -2,8 +2,8 @@ import time
import nfc import nfc
import subprocess import subprocess
import requests import requests
import asyncio
import oled import oled
from threading import Thread
url="http://172.16.1.105/api/" url="http://172.16.1.105/api/"
@ -21,7 +21,7 @@ def onTagSense(tag):
response = requests.post(f"{url}tag_id", data={"id":id}) response = requests.post(f"{url}tag_id", data={"id":id})
try: try:
if response.json()["mode"] == "balance" or response.json()["mode"] == "message": 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 return True
except: except:
None None

View file

@ -18,5 +18,10 @@ async def Balance(user_name, balance):
await time.sleep(5) await time.sleep(5)
await clear() 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__": if __name__ == "__main__":
Balance("Test", -255555) Balance("Test", -255555)