Files
pybricks-projects/snippets/ev3/bluetooth_pc/pcserver.py
T
Laurens Valk db10b75808 ev3/snippets/bluetooth_pc: run server as python3
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.
2020-05-07 11:56:36 +02:00

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!')