mirror of
https://github.com/pybricks/pybricks-projects.git
synced 2026-09-15 11:03:15 +00:00
This removes the MicroPython struct and socket specifics and replaces them with Python3 counterparts. Also a few changes are made to deal with strings, which on MicroPython are just bytes. Now, the server works on Python3 and client EV3s can connect to it.
14 lines
308 B
Python
14 lines
308 B
Python
#!/usr/bin/env python3
|
|
from pybricks.messaging import BluetoothMailboxServer, TextMailbox
|
|
|
|
server = BluetoothMailboxServer()
|
|
mbox = TextMailbox('greeting', server)
|
|
|
|
print('waiting for connection...')
|
|
server.wait_for_connection()
|
|
print('connected!')
|
|
|
|
mbox.wait()
|
|
print(mbox.read())
|
|
mbox.send('hello to you!')
|