This commit is contained in:
bton 2024-04-12 22:01:57 +02:00
parent f9b7045dbf
commit 657e19d23b
2 changed files with 7 additions and 1 deletions

View file

@ -2,6 +2,8 @@ import time
import nfc
import subprocess
import requests
import asyncio
import oled
url="http://172.16.1.105/api/"
@ -19,13 +21,14 @@ def onTagSense(tag):
response = requests.post(f"{url}tag_id", data={"id":id})
try:
if response.json()["mode"] == "balance" or response.json()["mode"] == "message":
asyncio.run(oled.Balance(response.json()["username"], response.json()["balance"]))
return True
except:
None
return False
def start_nfc_normal():
device = get_reader()
device = get_reader()i
clf = nfc.ContactlessFrontend(device)
clf.open(device)
while True:

View file

@ -1,6 +1,7 @@
from board import SCL, SDA
import busio
import adafruit_ssd1306
import time
i2c = busio.I2C(SCL, SDA)
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
@ -14,6 +15,8 @@ def Balance(user_name, balance):
display.text(str(user_name), 50, 0, (255,255,255), size=1)
display.text(str(balance), 0, 15, (255,255,255), size=2)
display.show()
time.sleep(5)
clear()
if __name__ == "__main__":
Balance("Test", -255555)