What is the COM port of serial port for Bluetooth for Raspberry Pi

Using this code:

import processing.serial.*;

Serial myPort;

printArray(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);

I am able to connect a comport via Bluetooth if use Windows in my laptop. But I tried applying it in my raspberry pi and I have not been successful so far. Does anyone know what name of the serial port that should be used to be able to access the serial connection of raspberry pi Bluetooth?

Thank you

I only use Windows (and Linux at occasion) and have no experience at all with a Raspberry Pi.

What is the output of printArray(Serial.list());? Did you try the different ports that are listed?

That would pick the first serial port. If I run it on Windows, it will pick COM1 which is a serial port that is by default available on my Win10 system and it will not be the Bluetooth port.

the list does not show in my raspberry pi screen, especially since I use the 3.5-inch touchscreen.

OK, so I guess that you can’t run shell commands either?

To find ports in Linux at the operating system level, you use lsusb and in case of problems dmesg -w; I have no reason to believe that it would be different on a Raspberry Pi. But you need a monitor and a keyboard. In which case your statement printArray(Serial.list()); should also give the required data.

Can’t you iterate over the list of serial ports and print each entry on that screen?

I was able to make it work with raspberry pi, but in the raspberry pi, you need to set rfcomm and apply it in the code above using the set rfcomm in exchange of the “com7” in the code. I have only 2 cons as of now that I am trying to resolve, communication has too much delay and when I restart the raspberry pi, you need to re-setup the rfcomm due to the reason that it releases the bind.

Great :+1:
Can you share the code? I’m just curious how you solved it but others can benefit if they encounter the same problem.

myPort = new Serial(this, “dev/rfcomm9”, 9600);

just a different port

1 Like