Hello everyone!
I have the following HM-10 module which is 5v tolerant: https://grobotronics.com/bluetooth-module-for-arduino-hm-10.html
I have connected it as such:
HM-10 -> Arduino
Vcc -> 5v
GND -> GND
STATE -> pin 11
Rx -> pin 10
Tx -> pin 9
BRK -> pin 5
I am using the SoftwareSerial library so that I keep my debugging log messages. Here is the relevant code:
else if (strcmp(options[result], "Disconnect") == 0) {
g_selection_pending = false;
digitalWrite(5, LOW);
delay(100);
digitalWrite(5, HIGH);
delay(100);
digitalWrite(5, LOW);
log_msg("DEBUG", "Sent pulse to pin 5 (connected to BRK)");
return DISCONNECTED;
}
I know that everything else works because I have it set up with a state machine and it does go into the DISCONNECTED state (i.e. my BT status LED connected to another pin turns off, the menu for the DISCONNECTED state is shown on my LCD, and I get a bunch of log messages in the Serial monitor).
However the onboard LED of the HM-10 remains powered on, and my App Inventor app still shows me as connected. I know the app works as well because if I force a disconnect (e.g. by briefly disconnecting the BLE module from power) it does reflect that in the app.
Anyway, I have tried switching the order of the pulse from L->H->L to H->L->H and that didnt work, I have also tried sending AT commands to it even though of course they wont work while a device is connected.
I'm at a loss here. Is it really impossible to initiate a disconnect from the HM-10 side of things?
Any help is appreciated, and please don't hesitate to ask for more info if you need it.
Thanks in advance.