Student_AJ
Posts: 8
Joined: Thu Apr 04, 2019 12:35 am

turn on bluetooth rp3b+

Thu Apr 18, 2019 11:39 pm

good morning,

my name is AJ, i'm a high school student new to rpi. I was looking into how to turn on and off the bluetooth on rpi using python, but I was not able to find anything that is applicable to what I am attempting to do.

please help, all help is kindly appreciated!

Andyroo
Posts: 4502
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: turn on bluetooth rp3b+

Fri Apr 19, 2019 1:52 am

You could have a look at https://github.com/pybluez/pybluez BUT its not being updated at this time.

Adafruit have released https://github.com/adafruit/Adafruit_Python_BluefruitLE - it’s experimental/ new and may need their module if it does not work fully on the Pi :o

You may be able to mod https://github.com/abstrakraft/cwiid to communicate with something other than a Wii remote!

There is over 150 projects for Python under Linux https://pypi.org/search/?q=Bluetooth - they may not be available on the Pi without a build though.
Need Pi spray - these things are breeding in my house...

User avatar
Douglas6
Posts: 4766
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: turn on bluetooth rp3b+

Fri Apr 19, 2019 1:19 pm

What exactly do you mean by "turn on and off the bluetooth"? You could run a shell command from Python to bring the adapter up or down:

Code: Select all

sudo hciconfig hci0 up 
or

Code: Select all

sudo hciconfig hci0 down

Return to “Python”