B4R Question HC-05 not able to communicate with ESP8266

Discussion in 'B4R Questions' started by AndroidMadhu, Jun 25, 2019.

  1. AndroidMadhu

    AndroidMadhu 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
    Code:
    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
     
  2. derez

    derez Expert Licensed 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.
     
  3. AndroidMadhu

    AndroidMadhu Member Licensed User

    I have tested.. but no luck....:(
     
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. AndroidMadhu

    AndroidMadhu Member Licensed User

    @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...
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Start with implementing it with a regular Arduino and the B4A program. Once it works switch to the ESP8266.
     
  7. tigrot

    tigrot Well-Known Member Licensed User

    Sometimes rx/tx pins on periferals are inverted, at least on some rs232/ttl interface.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice