test
This commit is contained in:
parent
e4e858c1b7
commit
52a9a22442
2 changed files with 5 additions and 4 deletions
|
@ -3,7 +3,7 @@ import nfc
|
||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
import oled
|
import oled
|
||||||
import subprocess
|
import asyncio
|
||||||
|
|
||||||
url="http://172.16.1.105/api/"
|
url="http://172.16.1.105/api/"
|
||||||
|
|
||||||
|
@ -19,9 +19,10 @@ def get_reader():
|
||||||
def onTagSense(tag):
|
def onTagSense(tag):
|
||||||
id = int.from_bytes(tag.identifier, "big")
|
id = int.from_bytes(tag.identifier, "big")
|
||||||
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":
|
||||||
subprocess.run(oled.balance(response.json()["username"], response.json()["balance"]))
|
oled.balance(response.json()["username"], response.json()["balance"])
|
||||||
return True
|
return True
|
||||||
#except:
|
#except:
|
||||||
# None
|
# None
|
||||||
|
|
4
oled.py
4
oled.py
|
@ -10,12 +10,12 @@ def clear():
|
||||||
display.fill(0)
|
display.fill(0)
|
||||||
display.show()
|
display.show()
|
||||||
|
|
||||||
def balance(user_name, balance):
|
async def balance(user_name, balance):
|
||||||
clear()
|
clear()
|
||||||
display.text(str(user_name), 50, 0, (255,255,255), size=1)
|
display.text(str(user_name), 50, 0, (255,255,255), size=1)
|
||||||
display.text(str(balance), 0, 15, (255,255,255), size=2)
|
display.text(str(balance), 0, 15, (255,255,255), size=2)
|
||||||
display.show()
|
display.show()
|
||||||
time.sleep(5)
|
await time.sleep(5)
|
||||||
clear()
|
clear()
|
||||||
|
|
||||||
def error(code):
|
def error(code):
|
||||||
|
|
Loading…
Reference in a new issue