I am using the HM-10 low energy bluetooth module and I am trying to verify that a sample BLE app is able to send some data to the arduino board over HM-10 and receive a response back.
So, I am using the code below. It works fine when I send a message from the Arduino Serial Monitor (and I see a response in the monitor). However, when I use one of these BLE apps on app store, connect with the HM-10 module and send a message, I was expecting I would see a response message "one" on the app but I do not see anything.
What am I missing?
#include <AltSoftSerial.h>
AltSoftSerial BTserial;
char c=' ';
void setup() {
Serial.begin(9600);
BTserial.begin(9600);
}
void loop() {
if (BTserial.available())
{
c = BTserial.read();
BTserial.write("one"); // <- this should show up in my BLE app as an RX but it doesn't. WHY?
}
// Read from the Serial Monitor and send to the Bluetooth module
if (Serial.available())
{
c = Serial.read();
Serial.write("two");
}
}
Notice in the attached screenshot of the app, when I send the character 'a', I don't see the response 'one' back to the app..
Thanks!