0

I am currently using raspberry pi 4 in my school project and i would like the Pi autoconnect during startup. However, i failed to do that. i have tried:

  1. File rc.local
  2. crontab -e My python script can run during startup but only bluetooth connection part does not work. I can assure that my script is working but by run it using pyhton software such as Geany,Thony python IDE etc.

The bluetooth part in my code as such:

if os.path.exists('/dev/rfcomm0') == False:
    path = 'sudo rfcomm bind 0 00:15:02:09:14:E5'
    os.system (path)
    time.sleep(1)

bluetoothSerial = serial.Serial( "/dev/rfcomm0", baudrate=9600 )

I tried to connect with HC-05 bluetooth module with arduino. I need the python script work without monitor to run the code where as the system 'on' it will work.

How can my python script connect bluetooth automatically during startup?

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.