HC-05 Unable to Transmit from HC05 to smart phone bluetooth terminal

Hello, I'm at a loss for what to do and come to you as my last hope. I've spent a couple of days (over 10 hours) trying to figure this out. I have a HC-05 which is working fine for receiving commands connected to an arduino uno using the schematic "hc05 circuit" I have attached in this thread below.

The problem though is I'm unable to use the HC-05 to transmit anything back to my smart phone. here is my code. It will turn an led on when it receives a 1 and turn the led off when it receives a 0. this works but I need to be able to send back a command to the smart phone so i can confirm the arduino has finished what it's done and the smart phone can continue. This is needed as I am writing my own android app using android studio, where I need to perform an action on the arduino when the user pushes a button and then wait for the arduino to reply when it's finished.

#include <SoftwareSerial.h> 
SoftwareSerial MyBlue(2, 3); // RX | TX 
int flag = 0; 
int LED = 8; 
void setup() 
{   
  Serial.begin(9600); 
  MyBlue.begin(9600); 
  pinMode(LED, OUTPUT); 
  Serial.println("Ready to connect\nDefault password is 1234 or 000"); 
} 
void loop() 
{ 
  if (MyBlue.available()) 
    flag = MyBlue.read(); 
    Serial.println(flag);
  if (flag == 49) 
  { 
    MyBlue.print(49); // THIS DOESN'T WORK I TRIED PRINT AND WRITE FUNCTION WITH NO RESULTS I RECIEVE NOTHING BACK TO MY PHONE
    MyBlue.write(49);
    digitalWrite(LED, HIGH); 
    Serial.println("LED On"); 
  } 
  else if (flag == 48) 
  { 
    digitalWrite(LED, LOW); 
    Serial.println("LED Off"); 
  } 
}

I have also attached the screenshot on my phone of the bluetooth terminal sending a 1 and 0 to the HC05 but nothing coming back. Please note that in the bluetooth screenshot, all the 1s and 0s are just me sending the data multiple times while testing. It's not the reply from the arduino.

amazon link to the HC-05 module i have: https://www.amazon.co.uk/gp/product/B01G9KSAF6/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&psc=1

app im using for testing transmit and recieve: https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal&gl=GB

I followed this tutorial from how to mechatronics on how to use the HC-05

hc05 circuit.jpg

hc05 circuit.jpg

The Morich terminal is pretty much the way to go these days but you might need to make sure it is set up for "classic" Bluetooth. I understand you are getting phone>Arduiono comms, so there can't be much wrong.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.