Git Product home page Git Product logo

Comments (7)

dmusican avatar dmusican commented on June 12, 2024 2

I'm a Linux user (Ubuntu 20.04) with a Spike Prime, and I landed here trying to make a bluetooth connection work. I couldn't get it to work at all until I saw the hint from @jeromba6 about setting the bluetooth connection to serial. I don't know if this is what that meant, but after some searching, here's what I came up with. I'm adding it here to help others, but also because if it so happens that this is a different approach, maybe it would help with the reported bug?

  • Run the command bluetooth devices to see the list of paired devices
  • Then run sudo rfcomm bind 0 <dev>, where <dev> is the hex device id associated with the robot from the above list

That worked. I was then able to connect with /dev/rfcomm0 with VSCode.

@jeromba6: I don't know if I've provided useful info, or just told you what you already knew. At the very least, thanks for getting me started. And further thanks to @PeterStaev for this fantastic VSCode extension.

from lego-spikeprime-mindstorms-vscode.

PeterStaev avatar PeterStaev commented on June 12, 2024 1

@dmusican thanks for the input on this issue. Just to add to this - the plugin communicates over COM with the Brick and not directly on BLE. This is done automatically for Windows and Mac and for both USB and BLE connections (i.e. when you connect the brick to the computer it automatically opens/creates the COM port). I guess on Linux it is not done automatically :(

from lego-spikeprime-mindstorms-vscode.

PeterStaev avatar PeterStaev commented on June 12, 2024

Hey @jeromba6 , sadly I'm not a linux user myself (I wasn't even able to compile the plugin on a Ubuntu VM...). Hopefully a more experienced linux user/dev could help on this.

from lego-spikeprime-mindstorms-vscode.

TheWendyPower avatar TheWendyPower commented on June 12, 2024

@dmusican I can't get this to work. I could be missing additional drivers. I follow this: https://gist.github.com/0/c73e2557d875446b9603 I can connect to the hub, but I'm unable to complete the sudo rfcomm bind 0 <dev> step, as it won't stay connected. It pairs and then disconnects.

from lego-spikeprime-mindstorms-vscode.

dmusican avatar dmusican commented on June 12, 2024

@TheWendyPower, I think that's by design. It pairs, then disconnects because you're not actually using it. It will then connect again when you actually connect to it from VSCode.

from lego-spikeprime-mindstorms-vscode.

foton avatar foton commented on June 12, 2024

Exactly. I start the BT on Ubuntu and RI (51515) hub and hub was after while displayed as "LEGO Hub A8:E2:C1:9C:67:16 disconnected" . According instructions from lego-hub-tk , I used commandsudo rfcomm connect /dev/rfcomm0 A8:E2:C1:9C:67:16 .

> sudo rfcomm connect /dev/rfcomm0 A8:E2:C1:9C:67:16
Connected /dev/rfcomm0 to A8:E2:C1:9C:67:16 on channel 1
Press CTRL-C for hangup

And bluetoothe state in "explorer" changed to "connected". On hub there is still blue button and "B" letter on display.

I can than select /dev/rfcomm0 from extension menu.... but it will throw VScode error Connecting to Hub Failed! Error: Operace zamítnuta, cannot open /dev/rfcomm0 ( "Operace zamítnuta" is in czech language, translated to english it is "Operation denied/forbidden") .

I tried instructions from webspace.fh-zwickau.de, to allow any user acces such connection (using UDEV rules).

And error changed Connecting to Hub Failed! Error Prostředek je dočasně nepřístupný Cannot lock port

When I connect hub by USB, I can run screen /dev/ttyACM0 115200 and it returns some number, which are changing when I move the hub. But VScode still says, that Connecting to Hub Failed! Error: Zařízení nebo zdroj jsou používány, cannot open /dev/ttyACM0 ("Zařízení nebo zdroj jsou používány" => "device or source is used")

from lego-spikeprime-mindstorms-vscode.

PeterStaev avatar PeterStaev commented on June 12, 2024

When I connect hub by USB, I can run screen /dev/ttyACM0 115200 and it returns some number, which are changing when I move the hub. But VScode still says, that Connecting to Hub Failed! Error: Zařízení nebo zdroj jsou používány, cannot open /dev/ttyACM0 ("Zařízení nebo zdroj jsou používány" => "device or source is used")

@foton this is a normal error since the COM ports do not allow simultanious connections. So while you have your screen running or you have connected through the LEGO app, no further connections are allowed. You need to close all and then try to connect through VSCode. Hopefully this helps.

from lego-spikeprime-mindstorms-vscode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.