[ArduinoBT] Anti-Hijack function and PIN13

Hi all,

I already got my ArduinoBT communicating with my phone and the phone sends the GPS speed over to Arduino to control a dozen LEDs. I also control some relays to turn on my engine of my motorcycle. I was thinking about making an anti-hijack function, if my phone disconnects from the BT module then I want to switch off the engine. (I can ofcourse overwrite this with a key switch in case my phone runs out of battery or something)

  • I saw some extensions of the libary serial, including the function list(). What is the best practice to get feature done? Using that extended libary, or send a command over to my arduino every 3 seconds to see if their connected? (like trains do?)

  • I also made a PCB but totally forgot that PIN13 is used for the LED, is it harmful to use this PIN to control a relay? like if the LED dies, can I still use that PIN?


Odds are the pin will die before the led,
it can still controll a transistor to drive a relay yes, except you should ty not to draw as much current on that pin( <20) to be safe
and yeah you will need to do something like that, can’t see any other way, its not like a serial communication can tell if the absence is because of nothing being sent or disconnected
I don’t have a arduinobt but I have a bluetooth to serial module, and while it doesn’t indicate a disconnection perhaps the arduino bt can, if you can send commands to thr module, perhaps you can check a connected flag or get a disconnect flag

If you use the handshake lines DTR and RTS you can detect a connection loss.