Code Works in Uno But Not Nano-Bluetooth Communication.

im doing simple Bluetooth communication between Two Arduinos. Code Works fine with The Uno as a slave(receiver) but if I use the Same code for the Nano, the Nano freezes every now and then as if you called a delay function. Are there difference that I should be aware of?

The Nano and Uno use the same microcontroller so code that works on one will work on the other.

There are a few hardware differences:

  • The Nano has the A6 and A7 pins (which I don't think is relevant in this case).
  • The Uno has an op-amp to control the LED on pin 13, while the Nano only has a resistor. That can only affect things connected to pin 13.
  • The Nano has less capable voltage regulators for the 3.3 V pin and also on the VIN pin. I would suspect this as the cause of your problem.

The issue happens to the Nano even if it powered by USB.

OK, that does eliminate the possibility of the problem being caused by the 5 V voltage regulator on the Nano. Are you powering the Bluetooth module from the 3.3 V pin on the Nano?

pert:
OK, that does eliminate the possibility of the problem being caused by the 5 V voltage regulator on the Nano. Are you powering the Bluetooth module from the 3.3 V pin on the Nano?

No, im powering it straight to 5v. For the Rx, im using a 1K and 2K resistors. im following the schematic that i found online by a video by "how to mechatronics " youtube channel.

is it possible that the Nano is defective? I had to burn its bootloader twice before I used it.

It is possible. It's always nice to have a spare board stashed away that you can pull out as a sanity check when you encounter strange problems like this.