[Raspberry Pi]Raspberry Pi 3 與 Arduino HC05 Auto Bind

  • 457
  • 0

畢業專題筆記

註:需先得知HC05 MAC Address

Step1:

至Raspberry Pi 3 terminal 輸入bluetoothctl,

進入bluetoothctl模式後,scan & pair Arduino的HC-05模組,以及得知HC-05的MAC Address。

Step2:

到/etc/Bluetooth&/etc/systemd/system資料夾,做rfcomm.conf&rfcomm.service設定

sudo nano /etc/bluetooth/rfcomm.conf

內容:

rfcomm1 {

    bind yes;

    device xx:xx:xx:xx:xx:xx;

    channel 1;

    comment "HC 05";}

sudo nano /etc/systemd/system/rfcomm.service

內容:

[Unit]

Description=RFCOMM service

After=bluetooth.service

Requires=bluetooth.service

 

[Service]

ExecStart=/usr/bin/rfcomm bind 1 xx:xx:xx:xx:xx:xx

Restart=on-failure

RestartSec=5s

RemainAfterExit=yes

[Install]

WantedBy=multi-user.target