0

I using Arduino UNO with HC06 This is my code

include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); 


void setup() {
  Serial.begin(9600);
  BTSerial.begin(9600);
}

void loop() {
  if (BTSerial.available()) {
    char data = BTSerial.read();
    Serial.print("get data:");
    Serial.println(data);
  }

  if (Serial.available()) {
    char data = Serial.read();
    BTSerial.write(data);
    Serial.print("send data: ");
    Serial.println(data);
  }
}

after I connect it by bluetooth with my macbook pro, I test on serial monitor like figure. It only print the "send data", but no print "get data". I don't know why!

enter image description here

1

1 Answer 1

0

".available()" function returns true when you have a signal or bytes on RX. You may have no signal or bytes on BTSerial RX pin.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.