B4R Question HC-05 not able to communicate with ESP8266

AndroidMadhu

Active Member
Licensed User
Hello,
I am using HC-05 with ESP8266.
The Interface is as below:
ESP8266------> HC-05
RX------> TX
TX------> RX
GND------> GND
3.3V------> 3.3V

I am able to connect successfully and Paired HC05 with my android mobile.
I have downloaded Bluetooth terminal HC05 to communicate with ESP8266.
But after successful pairing with my mobile I am not able to communicate.
Below is my code
B4X:
Public Serial1 As Serial
    'Private wifi As ESP8266WiFi
    Private Softserial As SoftwareSerial
    Private astream As AsyncStreams
End Sub

Private Sub AppStart
    Serial1.Initialize(9600)
    Log("AppStart")
    Softserial.Initialize(9600,5,4) '5 as for RX(D1) and 4 is for TX(D2)
    astream.Initialize(Softserial.Stream,"astream_NewData",Null)
End Sub


private Sub astream_NewData(buffer() As Byte)
    Log(buffer)
End Sub

Please advice
 

derez

Expert
Licensed User
Longtime User
If your ESP is from China then the numbers of the pins are incorrect, try the connection with pins 5,6 or 7 as these numbers are the same in all products.
Also - put an Error sub instead of the Null, maybe this is the reason.
 
Upvote 0

AndroidMadhu

Active Member
Licensed User
Complete example is available here:
@Erel... I checked your example and based on your example, I started to work on HC-05.
I have used softwareSerial Instead hardware Serial and that's why I am not using Inline C/C++
The only issue is I am not able to receive any data from Mobile to Serial Monitor.
As from my previous update... any wrong I am doing? Please advice...
 
Upvote 0
Top