Have you considered to use bash script instead of Arduino code? Also script can be configured to execute at the start of system.
You could create a simple shell script that sets the Bluetooth interface and connects to your phone. For example, I just created a quick script that does exactly that but it launches a blink script on the background:
#!/bin/sh ./blink & rfkill unblock bluetooth sleep 1 bluetoothctl << EOF connect 50:55:27:60:6B:3A quit EOF
if I run this script, the Edison connects automatically to my Android phone. You may notice that the pair command is not present, that's because it is needed only the first time. So, what I did was that I manually paired the device and then created this script.
Now, in order to make this run automatically every time your Edison boots, you would have to either create a system service or call the script from an Arduino sketch with the "system" command.
1 of 1 people found this helpful
Should I save above script as batch file? then in Arduino, it's system("./batchfile").