Arduino Micro connection with Leonardo with HC-05 Bluetooth module

Help, I’m desperate!
I can not talk to The Arduini!
The Bluetooth modules flash at 9600 baud.
Even if the load of the BT probe programs (TX and RX of Micro Leonardo) modules do not communicate with the serial!
I tried to use Serial1 in both Arduino modules

Here are my test programs:

// ****************TX su Micro
const int Tastatore = 6;
const int ledPin = 13;

void setup() {
Serial.begin(19200) ;
Serial1.begin(9600) ;
while (!Serial1);
pinMode(Tastatore, INPUT);
pinMode(ledPin, OUTPUT);
}

void loop() {
if (digitalRead(Tastatore)){
digitalWrite(ledPin, LOW);
Serial1.print(“of”);
Serial1.print("/");
}

else if (!digitalRead(Tastatore)) {
digitalWrite(ledPin, HIGH);
Serial1.print(“of”);
Serial1.print("/");
}
delay(4);
}

//************RX su Leonardo
/
int led = 13;
char Stringa_Ricevuta[3];
byte Indice_RX = 0;
byte inByte;

void setup() {
Serial.begin(19200) ;
Serial1.begin(9600) ;
pinMode(led, OUTPUT);
while (!Serial1);
}

void loop()
{
if (Serial1.available())
{
inByte =Serial1.read();
if ((inByte != 47) && (Indice_RX < 2)) //Ricevi il dato fino / all’invio e max 5 byte
{
Stringa_Ricevuta[Indice_RX++] = inByte;
}
else
{
if (strcmp(Stringa_Ricevuta, “of”) == 0)digitalWrite(led, LOW);
else if (strcmp(Stringa_Ricevuta, “on”) == 0)digitalWrite(led, HIGH);

Stringa_Ricevuta[Indice_RX] = 0;
Indice_RX = 0;
}
}
Serial.print(inByte);
}

void loop() {
  if (digitalRead(Tastatore)){
    digitalWrite(ledPin, LOW);
    Serial1.print("of");
    Serial1.print("/");
  }

  else if (!digitalRead(Tastatore)) {
    digitalWrite(ledPin, HIGH);
    Serial1.print("of");
    Serial1.print("/");
  }
  delay(4);
}

Does the led just always stay off? Why do you only send "of"? Shouldn't one of these send "on"?

I was wrong, to post the program. in fact I have already tried changing the data transmitted on, but does not work. That is, the LED 13 of the transmitter is switched on and off by pressing the button, but the receiver does not receive anything. I used both for micro and for Leonardo pins TX and RX with resistance from 2.2 KOhm and 1KOhm towards BT modules.

how you connected the bluetooth module? Can you detail the pins?

Start by connecting the two Arduinos with wires between the Serial1 pins on both boards. When that works try it with Bluetooth. When using wires you also need a GND connection between the boards.

I suggest using the 3rd example in Serial Input Basics and make the transmitting Arduino comply with it. There is also a parse example.

...R

Here the connection of Pin.

Micro Transmitter:

Pin Micro RX -> TX BT Pin

TX pin Micro -> R1kOhm R1KOhm -> Pin RX BT RX pin BT -> R2.2KOhm R2.2KOhm -> GND


Leonardo receiver:

Leonardo Pin RX -> TX BT Pin

Pin TX Leonardo -> R1kOhm R1KOhm -> Pin RX BT RX pin BT -> R2.2KOhm R2.2KOhm -> GND

Ok, if I connect with cables works. but why not work with modules? yet the link modules

If you add modules without resistance works. Because?

alpha1504: If you add modules without resistance works. Because?

Why did you think you might need resistors?

Is your Bluetooth module intended to work at 5v or at 3.3v?

...R

Hc - 05 module can be powered from 3.3 to 6 V. I 've powered at 5V . So you say you do not need any resistance?

I used a voltage divider at RX side of HC-05 and I didnt had any issues with it. Most probably the voltage divider connection might be wrong. A hand drawn schema might help to identify the issue.

alpha1504: Hc - 05 module can be powered from 3.3 to 6 V.

Can it take 5v on its data pins or must it only get 3.3v?

...R

Robin2: Can it take 5v on its data pins or must it only get 3.3v?

...R

Robin, I think RX and TX pin operates at 3.3v, I saw the info here.

Ok. I solved simply by removing the resistance. Thank you all!