--- /dev/null
+[Unit]
+Description=start bt_connect_bobbycar.sh
+Requires=bluetooth.target
+After=bluetooth.target
+
+[Service]
+Type=simple
+Restart=always
+RestartSec=5
+User=pi
+WorkingDirectory=/home/pi/2019-03-letsCluster-Hackathon/201903hackathon
+ExecStart=/home/pi/2019-03-letsCluster-Hackathon/201903hackathon/bt_connect_bobbycar.sh
+ExecStop=/home/pi/2019-03-letsCluster-Hackathon/201903hackathon/bt_disconnect_bobbycar.sh
+SyslogIdentifier=%i
+
+[Install]
+WantedBy=multi-user.target
+
#!/bin/zsh
local BOBBYCAR=30:AE:A4:15:24:72
+local RFDEV=/dev/rfcomm1
+sudo bluetoothctl <<< "disconnect $BOBBYCAR"
+sleep 5
sudo bluetoothctl <<< "connect $BOBBYCAR"
+sudo bluetoothctl <<< "trust $BOBBYCAR"
+sleep 8
+sudo rfcomm bind $RFDEV $BOBBYCAR 1
sleep 3
-sudo rfcomm bind /dev/rfcomm1 $BOBBYCAR 1
-sleep 3
-./cpp/openCVnaiveObstacleAvoidance/openCVnaiveObstacleAvoidance > /dev/rfcomm1
\ No newline at end of file
+./cpp/openCVnaiveObstacleAvoidance/openCVnaiveObstacleAvoidance > $RFDEV