I am learning still arduino programming and a have a major problem, it has me cornered, maybe someone could help me.
PROBLEM 1.
So it is this. I need to send anything char or int through arduino micro. I have found out that Arduino micro has only one RX and one TX pin. Option 1) Send data to arduino micro from my computer or android phone via JY-MCU BT module
Option 2) Send data from my computer or android phone via JY-MCU BT module to arduino micro, which will print it through Serial.print on serial monitor. Can someone plz explain to me as for total idiot what to do step by step or create and send a code which to use?
I already tried Hterm, PuTTY, Android apps, but none of them receives anything back. I connect to arduino BT module but nothing more, I have tried a lot of channels, programs and googling, but nothing gave me an answer what to do.
PROBLEM 2.
Am I doing something wrong or it (Soft at PC or cell) actually does not send information over BT?
One serial port is enough for bi directional communication with JY MCU BT module (I use it, model HC-07)
Here is example code:
void setup()
{
Serial.begin( 9600 );
}
void loop()
{
// Receive string from PC
if ( Serial.available() > 0 )
{
static char input[64];
static uint8_t i;
char c = Serial.read();
if ( c != '\r' && i < 64-1)
input[i++] = c;
else
{
input[i] = '\0';
i = 0;
// Send a message back to PC
char output[128];
sprintf( output, "String received from PC: \"%s\"", input );
Serial.println( output );
}
}
}
Make sure the BT module is paired with your Bluetooth USB dongle. Just power the BT module and search for new BT devices on your PC.
In the Arduino IDE, Tools menu, set the COM port to the one used by your Bluetooth USB dongle.
In the Arduino IDE's Serial Monitor, set Line Ending to Carriage Return.
You also have to set the Baud speed (in Serial Monitor and in the code) according to your BT module's configuration (default is 9600)
Also, since you don't provide schematic of your wiring, make sure the Arduino's RX go to the BT's TX (and so Arduino's TX, to BT's RX. You should also use a voltage divider for the RX of the BT module because it's not 5V tolerant.