27 lines
699 B
Python
27 lines
699 B
Python
import asyncio
|
|
import time
|
|
from esasdk import Machine
|
|
|
|
async def main():
|
|
# Connect to a machine
|
|
machine = Machine("ws://localhost:5424")
|
|
await machine.connect()
|
|
|
|
# send NFC UID
|
|
login = await machine.login_NFC("048CB772AC6D81")
|
|
loginInfo = login.split(" ")
|
|
userID = loginInfo[-1]
|
|
# start a game as jon
|
|
gameCode = "MAES"
|
|
countdown = 5
|
|
duration = 15
|
|
await machine.game_start(gameCode, userID, countdown, duration)
|
|
print(f"INFO: running {gameCode}")
|
|
# wait a stop event
|
|
await machine._await_message("STOPPED")
|
|
print("INFO: game stopped")
|
|
# Close connection
|
|
await machine.close()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main()) |