BT4502 transmit from UART to BLE app

I thought it is cheap so i bought it for my project. that i usually did with HC-05. HC-06 but, it worked not stably, i controlled it by arduino Mega 256, with 3.3 v supply. the longest time for sending data is 2 Mins. it disconnected after 5 second usually .
here is my code (really simple, i used all default )
Do you know the reason for not work long time? Please guide me. Thanks for your time.
And do you know how to fast reconnect from Android App. Sometime failed to reconnect .
void setup() {
// initialize both serial ports:
Serial1.begin(115200);
pinMode(14, OUTPUT); // PDN :14
pinMode(15, OUTPUT); // WAKEUP:15
digitalWrite(14, 1); // make sure high before low
digitalWrite(15, 1); // make sure high before low
delay(100);
digitalWrite(14, 0); // stop Sleep
digitalWrite(15, 0); // before send command
delay(5);
Serial1.write(“TTM”); //
}

void loop() {
digitalWrite(15, 1); // go to sleep
delay(100); // interval time between send
digitalWrite(15, 0); // wakeup before send
delay(5); // delay before send
Serial1.write(“Hello there, are you there”);
delay(10); // make sure data are sent; 1ms also OK
}

I changed your code like this and its Working

SoftwareSerial mySerial(2, 3); // RX, TX

void setup() {
// initialize both serial ports:
Serial.begin(9600);
mySerial.begin(115200);

pinMode(4, OUTPUT); // WAKEUP:4
pinMode(5, INPUT); // int:5

digitalWrite(4, HIGH); // make sure high before low
delay(1);
digitalWrite(5, HIGH);

digitalWrite(4, LOW); // before send command
delay(1);

digitalWrite(5, LOW);

// mySerial.println(“TTM”);
// delay(2000);

digitalWrite(4, HIGH); // make sure high after sending data
delay(1);
}

void loop()
{
mySerial.println(analogRead(A0));
// delay(10);
}

Hi Baozhu

Used HM-BT4502, i can connect with Android phone through “Serial Bluetooth Terminal”( I think every one use it to test Bluetooth). When I wrote App to connect with HM-BT4502, i used base code of Mr Kai-morich. I think he did “Serial Bluetooth Terminal”. the App link below.
(https://github.com/kai-morich/SimpleBluetoothTerminal/commits?author=kai-morich) some warning fixes

Problem is that i could not connect BT4502 with my Andrdoid phone thought new APP. After i debuged i saw “BLUETOOTH_LE_TIO_CHAR_TX_CREDITS” is not correct. (at SerialSocket, line 58-59), i tried to modify this number (i modified with number i received thought “Serial Bluetooth Terminal”), but was not successed. TX_CREDITS called by Mr Kai-morich, i dont understand what is this,How can i get that number.

I know it long text, and bother you much, but can you check this App ?
If you know some Open source APP can connect with HM-BT4502 , please tell me.

Thanks so much for your kindness.

hi
I wish to receive data from HM-BT4502 module on my BLUETOOTH SERIAL APP (which everyone use)
I am using Arduino Uno for it, can you share the code.
i have tried a lot but I don’t get it.

Hello, I have 2 HM-BT4502B modules. I can connect these modules one by one to the mobile and i can send or recieve data. But I can’t connect the two devices to each other. I don’t want to use an external MCU. HM-BT has programmable CMT4502(internal Arm Cortex M0). I couldn’t find any documentation or example on the internet to solve my connection problem (even one of the rare people using HM-BT4502). Can someone help me to connect two HM-BT4502s together?

I need this full project source code is it possible?

well anyone using this with arduino should know that this chip is 3.3v so you would need a level shifter to get the proper usage. even i was unaware that arduino uno uses 5v on vcc.