From 6a57abbff6a7e34665d4ce5de899df552ec57c59 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Wed, 25 Mar 2020 12:06:06 +0100 Subject: [PATCH] snippets/ev3/bluetooth: update mailbox name In examples, it is helpful to give unrelated things different names. --- snippets/ev3/bluetooth_client/client.py | 5 +++-- snippets/ev3/bluetooth_server/server.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/snippets/ev3/bluetooth_client/client.py b/snippets/ev3/bluetooth_client/client.py index 9fecc3e..4be2093 100644 --- a/snippets/ev3/bluetooth_client/client.py +++ b/snippets/ev3/bluetooth_client/client.py @@ -4,15 +4,16 @@ # paired using Bluetooth, but do NOT connect them. The program will take care # of establishing the connection. +# The server must be started before the client! + from pybricks.messaging import BluetoothMailboxClient, TextMailbox # This is the name of the remote EV3 we are connecting to. SERVER = 'ev3dev' client = BluetoothMailboxClient() -mbox = TextMailbox('mbox', client) +mbox = TextMailbox('greeting', client) -# The server must be started before the client! print('establishing connection...') client.connect(SERVER) print('connected!') diff --git a/snippets/ev3/bluetooth_server/server.py b/snippets/ev3/bluetooth_server/server.py index 7ef9e44..9f325ee 100644 --- a/snippets/ev3/bluetooth_server/server.py +++ b/snippets/ev3/bluetooth_server/server.py @@ -4,10 +4,12 @@ # paired using Bluetooth, but do NOT connect them. The program will take care # of establishing the connection. +# The server must be started before the client! + from pybricks.messaging import BluetoothMailboxServer, TextMailbox server = BluetoothMailboxServer() -mbox = TextMailbox('mbox', server) +mbox = TextMailbox('greeting', server) # The server must be started before the client! print('waiting for connection...') @@ -18,4 +20,4 @@ print('connected!') # and then sends a reply. mbox.wait() print(mbox.read()) -mbox.send('hello to you too!') +mbox.send('hello to you!')