I am currently trying to create Arduino based device that uses bluetooth communication (HM10). I've connected HM10 to arduino by SoftwareSerial.h and I've connected Arduino to PC via USB, I am using a serial monitor to communicate between board and pc.
Idea is simple: The board should just simply read a message from the serial connection "A" and pass it by another serial connection "B" to HM 10. HM10 is then sending the message by a bluetooth to a connected device. Also it should receive a message, by serial connection "B" from HM10 and pass it to my PC by serial connection "A"
On my mobile device I'm using MSMBle application to connect by bluetooth to HM10 and communicate with it.
After connecting arduino to pc, opening serial monitor and connecting my phone by this application to the HM10 I can send ASCII text by serial monitor from my PC to arduino and my phone does receive it, I see it on my mobile phone. But when I'm sending some message by bloetooth to HM10 arduino does not receive it.
HM10 does receive it: If I'm connecting HM10 directly to my PC I am able to receive and send messages with my serial monitor. So HM10 is receiving message and does pass it by serial (TR, TX) to Arduino but Arduino does just not read it for some reason.
I am using this tutorial: enter link description here
This is the code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 9); // RX, TX
// Connect HM10 Arduino Uno
// Pin 1/TXD Pin 7
// Pin 2/RXD Pin 8
void setup() {
Serial.begin(9600);
// If the baudrate of the HM-10 module has been updated,
// you may need to change 9600 by another value
// Once you have found the correct baudrate,
// you can update it using AT+BAUDx command
// e.g. AT+BAUD0 for 9600 bauds
mySerial.begin(9600);
mySerial.print("AT+NAMEnazwak2");
Serial.print("serial_ok");
}
void loop() {
//Serial.print("test");
char c;
if (Serial.available()) {
c = Serial.read();
mySerial.print(c);
}
if (mySerial.available()) {
c = mySerial.read();
Serial.print("ok");
Serial.print(c);
}
}
Please help me, what am I doing wrong?
This was just a strange hardware issue. Works well on other boards