|
|
@@ -5,6 +5,7 @@ from PIL import Image, ImageTk
|
|
|
import time
|
|
|
import asyncio
|
|
|
from dobluetooth import connect, getData
|
|
|
+import dobluetooth
|
|
|
|
|
|
"""
|
|
|
parse esp32 data string and make each axis and accell data its own varible
|
|
|
@@ -85,22 +86,8 @@ placeLeaderboard()
|
|
|
#label.grid(column=0,row=0)
|
|
|
#progressbar.grid(column=25,row=8)
|
|
|
|
|
|
-async def runLoop():
|
|
|
- target_address = await connect()
|
|
|
- if target_address is not None:
|
|
|
- async with BleakClient(target_address) as client:
|
|
|
- print(f"Connected: {client.is_connected}")
|
|
|
-
|
|
|
- while 1:
|
|
|
- try:
|
|
|
- data = await client.read_gatt_char(CHARACTERISTIC_UUID)
|
|
|
- datastr = data.decode('utf-8') #convert byte to str
|
|
|
- print("time: {} ||| numbers: {}".format(time.time(),convertToNumbers(datastr)))
|
|
|
- except Exception:
|
|
|
- print("failed to get data, restarting connection.")
|
|
|
-
|
|
|
def data():
|
|
|
- asyncio.run(getData())
|
|
|
+ asyncio.run(dobluetooth.getData())
|
|
|
|
|
|
app.after(1000,data)
|
|
|
app.mainloop()
|