Connection Backends
Backends are used by nxt.locator.find()
. You will usually not use them
directly.
USB
- class nxt.backend.usb.USBSock(dev)
USB socket connected to a NXT brick.
- bsize = 60
Block size.
- type = 'usb'
Connection type, used to evaluate latency.
- close()
Close the connection.
- class nxt.backend.usb.Backend
USB backend.
Bluetooth
- class nxt.backend.bluetooth.BluetoothSock(bluetooth, host)
Bluetooth socket connected to a NXT brick.
- bsize = 118
Block size.
- type = 'bluetooth'
Connection type, used to evaluate latency.
- close()
Close the connection.
Device file
- class nxt.backend.devfile.DevFileSock(filename)
Device file socket connected to a NXT brick.
- bsize = 118
Block size.
- type = 'bluetooth'
Connection type, used to evaluate latency.
- close()
Close the connection.
- class nxt.backend.devfile.Backend
Device file backend.
This uses a device file present on Linux or macOS /dev file system, which allows to connect to the NXT brick without needing a Bluetooth python package.
You only need to use this backend if the
bluetooth
backend is not working for you.On Linux, you need to pair the NXT brick, then you can use the rfcomm tool:
sudo rfcomm bind 0 00:16:53:01:02:03
Where
00:16:53:01:02:03
is the Bluetooth address of your NXT brick. This will create a/dev/rfcomm0
device file which can be used to communicate with the NXT brick.On macOS, you need to pair the NXT brick, then open Bluetooth preferences, select the NXT brick, click “Edit serial ports”. It should show “NXT-DevB-1”. If not, add a serial port using:
Port name: NXT-DevB-1
Device service: Dev B
Port type: RS-232
This should create a
/dev/tty.NXT-DevB-1
device file which can be used to communicate with the NXT brick.- find(name=None, filename=None, **kwargs)
Find bricks connected using Bluetooth using device file.
Socket
- class nxt.backend.socket.SocketSock(host, port)
Socket socket connected to a NXT brick.
- bsize = 60
Block size, conservative.
- type
Connection type, used to evaluate latency, known on connection.
- close()
Close the connection.