I can send data to Arduino from my pc through HM-10. But how can I use the Bleak library with the Tkinter library?
async def run(address):
async with BleakClient(address) as client:
async def ehyyy():
await client.write_gatt_char(MODEL_NBR_UUID,b"hello")
main = Tk()
main.title("app")
main.geometry("700x500")
main.resizable("false","false")
main.configure(background='#595959')
Nsonglogo = PhotoImage(file="logos/dot.png")
buttonNsong = Button(main, border=0, command=ehyyy, bg="#595959", image =Nsonglogo, activebackground="#595959")
buttonNsong.pack()
buttonNsong.place(x=402,y=380)
main.mainloop()
loop = asyncio.get_event_loop()
loop.run_until_complete(run(address))
When I click the button, I receive this error:
coroutine 'run.<locals>.ehyyy' was never awaited
self.tk.mainloop(n)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback