There are two main flavours of Bluetooth - Classic and LE. Classic can provide an RFCOMM/SPP service that works as a two-way serial link to transfer data both ways. LE is more limited in the amount of data it can handle, and is not really intended to be used as a serial link. MIT Inventor is set up for SPP Classic, but bleak is LE. You need a Classic server that makes a serial service available on the Pi. I have a github Python library with a ready-to-run program that has an option to act as a Classic server.
https://github.com/petzval/btferret
If you just want a quick Python code without using the btferret library, see section 5.4.4 in the documentation, and the program filetransfer.py.
Or, to use btferret:
If this works, you can write your own server - maybe using classic_server.py as a starting point.
https://github.com/petzval/btferret
If you just want a quick Python code without using the btferret library, see section 5.4.4 in the documentation, and the program filetransfer.py.
Or, to use btferret:
Code:
Follow the Python set up instructions in section 2.2 of the documentationRun btferret sudo python3 btferret.pyOn the btferret command line: s - Start a server, select Classic Input node = 0 Any device Security = 0, 1, or 3 - find which one works The MIT code must send ASCII data packets with line feed (10) as a termination character.You can write code to change this to use your own format.
Statistics: Posted by petzval — Thu Aug 01, 2024 12:08 pm