Method: NXT::Interface::Usb#connect
- Defined in:
- lib/nxt/interface/usb.rb
#connect ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nxt/interface/usb.rb', line 19 def connect @usb_context = LIBUSB::Context.new @dev = @usb_context.devices(idVendor: ID_VENDOR_LEGO, idProduct: ID_PRODUCT_NXT).first raise UsbConnectionError, 'Could not find NXT attached as USB device' if @dev.nil? @connection = @dev.open @connection.claim_interface(INTERFACE) @connection end |